Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145978 | Jul 16,2019 02:10 PM UTC | Jul 18,2019 02:01 PM UTC | WPF | 3 |
![]() |
Tags: DocIO |
//Creates a new Word document
WordDocument document = new WordDocument();
//Add one section and one paragraph
document.EnsureMinimal();
//Get the last paragraph.
WParagraph paragraph = document.LastParagraph as WParagraph;
paragraph.AppendText("Symbol using character code : ");
//Append fraction symbol using its character code.
paragraph.AppendText("\u00BD");
//Add paragraph into the Word document
paragraph = document.LastSection.AddParagraph() as WParagraph;
paragraph.AppendText("Custom formula using Equation field ");
//Append equation field
WField field = paragraph.AppendField("EQ", FieldType.FieldExpression) as WField;
//Set field code to preserve fractions
field.FieldCode = "EQ \\f(2,3)";
//Saves and closes the Word document
document.Save("Sample.docx");
document.Close();
|
//Creates a new Word document
WordDocument document = new WordDocument();
//Add one section and one paragraph
document.EnsureMinimal();
//Get the last paragraph.
WParagraph paragraph = document.LastParagraph as WParagraph;
//Append fraction symbol using its character code.
paragraph.AppendText("1/2" + " " + "\u00BD");
WTextRange text = paragraph.ChildEntities[0] as WTextRange;
//Sets the size for the text
text.CharacterFormat.FontSize = 12;
//Saves and closes the Word document
document.Save("Sample.docx");
document.Close();
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.