Comments (6)
Hi,
You can set a font + fontSize for all items of a list :
document.InsertList( bulletedList, new Xceed.Document.NET.Font( "Cooper Black"), 15 );
or you can format any listItem :
bulletedList.Items[ 2 ].Color( Color.Red );
from docx.
Looking for this too, please help!
from docx.
Hi!
Cant find how to change points on a dash in list.
And i need:
Help me please :)
from docx.
I don't think this is currently possible.
Will look into this.
Thanks for pointing this out.
from docx.
Oh... ok :(
Thanks.
from docx.
This feature is now available in Plus version since release 1.9.
In List, the ListOptions property can now be used to get/set the list configuration, including the list type, the list modification tracking, and the list levels configuration.
/// <summary>
/// Create a custom numbered list with different listItem's levels, items and numbering formatting.
/// </summary>
public static void AddCustomNumberedList()
{
Console.WriteLine( "\tAddCustomNumberedList()" );
// Create a document.
using( var document = DocX.Create( ListSample.ListSampleOutputDirectory + @"AddCustomNumberedList.docx" ) )
{
// Add a title
document.InsertParagraph( "Adding a custom numbered list into a document" ).FontSize( 15d ).SpacingAfter( 50d ).Alignment = Alignment.center;
// Add a custom numbered list.
// Create the list levels configuration
var customNumberedListOptions = new ListOptions()
{
ListType = ListItemType.Numbered,
LevelsConfigs = new ObservableCollection<ListLevelConfig>()
{
new ListLevelConfig()
{
NumberingFormat = NumberingFormat.upperRoman,
NumberingLevelText = "%1)",
Justification = Justification.left,
Indentation = new Indentation()
{
Hanging = 18f,
Left = 16f
},
Formatting = new Formatting()
{
FontColor = Color.DarkMagenta,
Bold = true
}
},
new ListLevelConfig()
{
NumberingFormat = NumberingFormat.lowerRoman,
NumberingLevelText = "%2.",
Justification = Justification.left,
Formatting = new Formatting()
{
FontColor = Color.Blue,
Bold = true
}
}
,
new ListLevelConfig()
{
NumberingFormat = NumberingFormat.decimalNormal,
NumberingLevelText = "%3.",
Justification = Justification.left
}
,
new ListLevelConfig()
{
NumberingFormat = NumberingFormat.bullet,
NumberingLevelText = "*",
Justification = Justification.left
}
}
};
// Create a numbered list with the specified list options.
var customNumberedList = document.AddList( customNumberedListOptions );
// Add first item in the list.
customNumberedList.AddListItem( "Cars" );
// Add Sub-items(level 1) to the preceding ListItem.
customNumberedList.AddListItem( "Cadillac", 1 );
customNumberedList.AddListItem( "Mercedes-Benz", 1 );
// Add Sub-items(level 2) to the preceding ListItem.
customNumberedList.AddListItem( "SUVs", 2 );
// Add Sub-items(level 3) to the preceding ListItem.
customNumberedList.AddListItem( "GLA SUV", 3 );
// Add Sub-items(level 4) to the preceding ListItem.
customNumberedList.AddListItem( "GLA 250 4MATIC SUV", 4 );
customNumberedList.AddListItem( "AMG GLA 35 4MATIC SUV", 4 );
// Add Sub-items(level 5) to the preceding ListItem.
customNumberedList.AddListItem( "AMG-enhanced 2.0L inline-4 turbo Engine", 5 );
customNumberedList.AddListItem( "AMG SPEEDSHIFT DCT 8-speed dual-clutch Automatic", 5 );
customNumberedList.AddListItem( "AMG GLA 45 4MATIC SUV", 4 );
customNumberedList.AddListItem( "GLB SUV", 3 );
customNumberedList.AddListItem( "GLC SUV", 3 );
customNumberedList.AddListItem( "GLE SUV Coupe", 3 );
customNumberedList.AddListItem( "Sedans & Wagons", 2 );
// Add Sub-items(level 3) to the preceding ListItem.
customNumberedList.AddListItem( "A-Class Hatch", 3 );
customNumberedList.AddListItem( "A-Class Sedan", 3 );
customNumberedList.AddListItem( "C-Class Sedan", 3 );
customNumberedList.AddListItem( "Coupes", 2 );
customNumberedList.AddListItem( "Convertibles & Roadsters", 2 );
// Add more items at level 1.
customNumberedList.AddListItem( "Maybach", 1 );
customNumberedList.AddListItem( "Toyota", 1 );
customNumberedList.AddListItem( "BMW", 1 );
// Add an item (level 0)
customNumberedList.AddListItem( "Boats" );
customNumberedList.AddListItem( "Dinghies", 1 );
customNumberedList.AddListItem( "Fish-and-ski Boat", 1 );
customNumberedList.AddListItem( "Sportfishing Yachts", 1 );
customNumberedList.AddListItem( "Trawlers", 1 );
// Add an item (level 0)
customNumberedList.AddListItem( "Planes" );
// Add Sub-items(level 1) to the preceding ListItem.
customNumberedList.AddListItem( "Aerospatiale", 1 );
customNumberedList.AddListItem( "Boeing", 1 );
customNumberedList.AddListItem( "Bombardier", 1 );
customNumberedList.AddListItem( "Eclipse Aerospace", 1 );
customNumberedList.AddListItem( "Embraer", 1 );
// Insert the list into the document.
document.InsertParagraph( "This is a custom Numbered List:\n" );
document.InsertList( customNumberedList );
document.Save();
Console.WriteLine( "\tCreated: AddCustomNumberedList.docx\n" );
}
}
public class ListSymbol
{
public string FontName;
public int Code;
public ListSymbol( string fontName, int code )
{
this.FontName = fontName;
this.Code = code;
}
public string UnicodeToString()
{
return char.ConvertFromUtf32( this.Code );
}
}
from docx.
Related Issues (20)
- can not support doc? HOT 3
- Large Table building performance in v2.4 HOT 1
- Inserting hyperlinks completes yet resulting file is corrupted HOT 3
- replancetextwithobject error HOT 1
- System.OutOfMemoryException HOT 3
- Writing a long docx file HOT 1
- ReplaceText in Header/Footer broke in v 2.5.0 HOT 3
- KeepWithNextParagraph() is not working with table rows HOT 1
- Inserting HTML not supported HOT 1
- how to insert a audio or other binary files HOT 2
- [Table] Lost cell with InsertRow() fuction HOT 1
- Does the library support "if" conditions?
- Support for multi-type series icons HOT 3
- DocX.ConvertToPdf() does not convert inserted html content. HOT 5
- [question] Loop through document items HOT 7
- Replace Tag to image not work HOT 1
- InsertContent as append from Paragraph HOT 3
- Table.IndentFromLeft not working? HOT 4
- Issue Loading ListParagraph when using Document template HOT 1
- No way to add parallel images HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docx.