Asian Typography Line Break Group In Word Document
In this tutorial, we are going to show you how to use Asian Typography line break group in word document feature with Aspose.Words for .NET. Follow the steps below to understand the source code and apply formatting changes.
Step 1: Loading the document
To get started, specify the directory for your documents and load the document containing the Asian typography into a Document object. Here’s how:
// Path to the documents directory.
string dataDir = "YOUR DOCUMENTS DIRECTORY";
Document doc = new Document(MyDir + "Asian typography.docx");
Step 2: Asian Typography Setup
We will now configure the Asian typography settings for the first paragraph of the document. Here’s how:
ParagraphFormat format = doc.FirstSection.Body.Paragraphs[0].ParagraphFormat;
format. FarEastLineBreakControl = false;
format. WordWrap = true;
format. HangingPunctuation = false;
Step 3: Saving the document
After inserting the text input form field, save the document to the desired location using the Save
method. Make sure to provide the appropriate file path:
doc.Save(dataDir + "DocumentFormatting.AsianTypographyLineBreakGroup.docx");
Example source code for Asian Typography Line Break Group using Aspose.Words for .NET
Here is the complete source code for Asian Typography Line Break Group feature with Aspose.Words for .NET:
// The path to the documents directory.
string dataDir = "YOUR DOCUMENT DIRECTORY";
Document doc = new Document(MyDir + "Asian typography.docx");
ParagraphFormat format = doc.FirstSection.Body.Paragraphs[0].ParagraphFormat;
format.FarEastLineBreakControl = false;
format.WordWrap = true;
format.HangingPunctuation = false;
doc.Save(dataDir + "DocumentFormatting.AsianTypographyLineBreakGroup.docx");
With this code you will be able to apply Asian Typography line break group using Aspose.Words for .NET.
Conclusion
In this tutorial, we explored the “Asian Typography Line Break Group” feature in Aspose.Words for .NET. By configuring the FarEastLineBreakControl
, WordWrap
, and HangingPunctuation
properties of the ParagraphFormat
, we were able to control the line breaking behavior for Asian typography in a Word document. This feature is useful for handling Asian characters and ensuring proper line breaks and word wrapping in documents with mixed language content.
FAQ’s
Q: What is the “Asian Typography Line Break Group” feature in Aspose.Words for .NET?
A: The “Asian Typography Line Break Group” feature in Aspose.Words for .NET allows you to control the line breaking behavior for Asian typography in a Word document. Specifically, it affects how lines are broken and wrapped when dealing with Asian characters in paragraphs.
Q: How do I enable the “Asian Typography Line Break Group” in Aspose.Words for .NET?
A: To enable the “Asian Typography Line Break Group,” you need to configure the FarEastLineBreakControl
, WordWrap
, and HangingPunctuation
properties of the ParagraphFormat
for the relevant paragraph(s) in your document. Setting FarEastLineBreakControl
to false
ensures that Asian characters are treated similarly to Latin characters regarding line breaking. WordWrap
set to true
enables word wrapping for Asian typography, and HangingPunctuation
set to false
prevents punctuation from hanging in Asian text.
Q: Can I apply the “Asian Typography Line Break Group” to specific paragraphs in a document?
A: Yes, you can apply the “Asian Typography Line Break Group” settings to specific paragraphs in a Word document. In the example code, the settings are applied to the first paragraph of the document. You can adjust the code to target other paragraphs as needed by accessing them through the Paragraphs
collection of the relevant section(s) in the document.