Is it possible to make a excel sheet right to left with closedXML
Asked Answered
T

1

9

I am using closedXML to generate a XML file(in arabic) and i need this file to be in right to left layout how can it do this in closedXML.

XLWorkbook wb = new XLWorkbook();
var ws = wb.Worksheets.add("Sheet1");
ws.Cell(1,1).Value = "مرحبا";
ws.Style.Alignment.ReadingOrder = XLAlignmentReadingOrderValues.RightToLeft;
Touraco answered 28/6, 2016 at 6:21 Comment(0)
C
18

Both the XLWorkbook and XLWorksheet objects have a RightToLeft property. You can either set it to true for the entire workbook or for each individual sheet.

var workbook = new XLWorkbook {RightToLeft = true}; // <-- Workbook default RTL
var worksheet = workbook.Worksheets.Add("Sample Sheet");
worksheet.Cell("A1").Value = "Hello World!";
// worksheet.RightToLeft = true;  <-- To set RightToLeft for individual worksheets
workbook.SaveAs("HelloWorld.xlsx");
Cankered answered 28/6, 2016 at 7:42 Comment(1)
i am using closedXML version 0.56.2.0 and i am unable to find this worksheet.RightToLeft = true;Touraco

© 2022 - 2024 — McMap. All rights reserved.