我正在创建具有从右到左表格的新文档。如何将表格方向设置为 RTL?
我尝试了以下代码,但它不起作用:
Table tb = new Table(new TableLayout() { Type = TableLayoutValues.Autofit });
tb.Append( new TableProperties(new TextDirection() { Val=TextDirectionValues.TopToBottomRightToLeft}, new RightToLeftText() { Val =new DocumentFormat.OpenXml.OnOffValue(true) }, new TableBorders(new TopBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 }, new BottomBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 }, new LeftBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 }, new RightBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 }, new InsideHorizontalBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 }, new InsideVerticalBorder { Val = new DocumentFormat.OpenXml.EnumValue<BorderValues>(BorderValues.BasicThinLines), Size = 5 })));
最佳答案
TableProperties tblProp = new TableProperties();
tblProp.BiDiVisual = new BiDiVisual { Val = new EnumValue<OnOffOnlyValues> { Value = OnOffOnlyValues.On } };
关于c# - 如何使用 openxml.wordprocessing 设置 "table direction",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55525456/