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;
ClosedXML is a . NET library for reading, manipulating and writing Excel 2007+ (. xlsx, . xlsm) files.
ClosedXML is an open source library created based on OpenXmlSdk. It's more user friendly. ClosedXML is a . NET library for reading, manipulating and writing Excel 2007+ (.
ClosedXML is not thread-safe. There is no guarantee that parallel operations will work. The underlying OpenXML library is also not thread-safe. If you get an exception The type initializer for 'Gdip' threw an exception.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With