hi everybody
we prefer use the word’s build-in style to replace the user’s custom style.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a paragraph style and specify some formatting for it.
Style style = doc.Styles.Add(StyleType.Paragraph, "MyStyle1");
style.Font.Size = 24;
style.Font.Name = "Verdana";
style.ParagraphFormat.SpaceAfter = 12;
// Apply the paragraph style to the current paragraph in the document and add some text.
builder.ParagraphFormat.Style = style;
builder.Writeln("Hello World: MyStyle1.");
builder.Writeln("Hello World: MyStyle1.");
builder.Writeln("Hello World: MyStyle1.");
// Change to a paragraph style that has no list formatting.
builder.ParagraphFormat.Style = doc.Styles["Normal"];
builder.Writeln("Hello World: Normal.");
//Change style of first paragraph of document
Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);
para.ParagraphFormat.ClearFormatting();
para.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
doc.Save(MyDir + "Out.docx");
hi, Tahir
Hi Pyntia,
- All references to the style are removed from corresponding paragraphs, runs and tables.
- If base style is removed its formatting is moved to child styles.
- If style to be deleted has a linked style, then both of these are
deleted.
Document doc = new Document(MyDir + "in.docx");
doc.Styles["listtemplate"].Remove();
doc.Save(MyDir + "Out.docx");
hi, Tahir
Hi Pyntia,
the newest aspose.words 14.2
Hi Pyntia,
hi,
Hi Pyntia,
Document doc = new
Document(MyDir + “in.doc”);<o:p></o:p>
ArrayList nonbuiltinstyles = new ArrayList();
foreach (Style style in doc.Styles)
{
if (style.Name.EndsWith("Char")) continue;
if (!style.BuiltIn && style.StyleIdentifier == StyleIdentifier.User)
{
nonbuiltinstyles.Add(style);
}
}
foreach (Style style in nonbuiltinstyles)
{
style.Remove();
}
doc.Save(MyDir + "Out.doc");
hi, Tahir
The issues you have found earlier (filed as WORDSNET-9848) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.