繁体   English   中英

如何在C#.Net的aspose.word中更改TOC的方向

[英]how to change direction of TOC in aspose.word for C# .Net

我通过Aspose.Word创建目录,但我的文档方向是从右到左,我想将方向更改为rtl。

请使用以下代码示例从右到左方向创建目录。 希望这对您有所帮助。

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

// Create a document builder to insert content with into document.
DocumentBuilder builder = new DocumentBuilder(doc);

// Specify the locale so Microsoft Word recognizes this text as Arabic - Saudi Arabia.

builder.Font.LocaleIdBi = 1025;
builder.ParagraphFormat.Bidi = true;
builder.Font.NameBi = "Heading 1";
builder.Font.SizeBi = 10;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.Font.Bidi = true;

doc.Styles[StyleIdentifier.Toc1].ParagraphFormat.Bidi = true;
doc.Styles[StyleIdentifier.Toc1].Font.Bidi = true;

builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
builder.Writeln();

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("مرحبا هناك ما هو اسمك وماذا تفعل في هذا");

// Call the method below to update the TOC.
doc.UpdateFields();
doc.Save(MyDir + "output.docx");

我与Aspose一起担任开发人员推广人员。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM