hossein safavi
hossein safavi

Reputation: 95

how to set "table direction", using openxml.wordprocessing

I'm working to create new document that has a Right to Left table. how can i set table direction to RTL?

i tried the following code but it isn't working:

             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 }))); 

Upvotes: 2

Views: 599

Answers (1)

M-Sha
M-Sha

Reputation: 96

TableProperties tblProp = new TableProperties();
tblProp.BiDiVisual = new BiDiVisual { Val = new EnumValue<OnOffOnlyValues> { Value = OnOffOnlyValues.On } };

Upvotes: 5

Related Questions