Free Support Forum - aspose.com

Horizontal text direction in a vertical text layout direction document

Hello,

How can I change some text to horizontal when the document text layout direction is vertical by Aspose.Words?Like the function “Asian layout"→"Horizontal in Vertical” in Word?
thx.

Hi Cheng-Hung,


Thanks for your inquiry. TextBox.LayoutFlow enumeration is used to determine the flow of the text layout in a textbox Shape. Please see the following code snippets for your kind reference. Hope this helps you.

If you face any issue, please share your document for investigation purposes.

Document doc = new Document(MyDir + "in.docx");

// get first shape

Shape textBox = (Shape)doc.GetChild(NodeType.Shape, 0, true);

textBox.TextBox.LayoutFlow = LayoutFlow.TopToBottom;

doc.Save(MyDir + "Out.docx");

Document doc = new Document();

// Create a new shape of type TextBox

Shape textBox = new Shape(doc, ShapeType.TextBox);

// Set the textbox height and width.

textBox.Height = 100;

textBox.Width = 100;

textBox.TextBox.LayoutFlow = LayoutFlow.TopToBottom;

textBox.AppendChild(new Paragraph(doc));

Paragraph para = textBox.FirstParagraph;

para.ParagraphFormat.Alignment = ParagraphAlignment.Center;

// Add some text to the paragraph.

Run run = new Run(doc);

run.Text = "Content in textbox Content in textbox Content in textbox Content in textbox";

para.AppendChild(run);

// Append the textbox to the first paragraph in the body.

doc.FirstSection.Body.FirstParagraph.AppendChild(textBox);

doc.Save(MyDir + "Out.docx");

Thanks for your solution. ^^

Hi Cheng-Hung,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.