我正在使用closedXML生成一个XML文件(阿拉伯语),我需要这个文件在从右到左的布局中如何在closedXML中执行此操作。
XLWorkbook wb = new XLWorkbook();
var ws = wb.Worksheets.add("Sheet1");
ws.Cell(1,1).Value = "مرحبا";
ws.Style.Alignment.ReadingOrder = XLAlignmentReadingOrderValues.RightToLeft;
答案 0 :(得分:4)
XLWorkbook和XLWorksheet对象都具有RightToLeft
属性。您可以为整个工作簿或每张工作表将其设置为true
。
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");