Posted 23 October 2024, 3:08 am EST
Issue: Setting Right-to-Left for the active sheet and exporting the Excel file. While all updates are reflected in the exported file, the Right-to-Left option is not present.
Package versions:
@grapecity/spread-excelio: 17.1.7
@grapecity/spread-sheets: 17.1.7
@grapecity/spread-sheets-react: 17.1.0
@grapecity/spread-sheets-designer: 17.1.7
@grapecity/spread-sheets-designer-react: 17.1.7
import * as ExcelIO from '@grapecity/spread-excelio';
import GCDesigner from '@grapecity/spread-sheets-designer';
export const getWorkbookJSONFromDesigner = (
designer: GCDesigner.Spread.Sheets.Designer.Designer,
) => {
const workbook = designer.getWorkbook();
// @ts-ignore toJSON does not exist
return JSON.stringify(workbook.toJSON());
};
export const getExcelBlobFromDesignerJSON = (
designer: GCDesigner.Spread.Sheets.Designer.Designer,
): Promise<Blob> => {
const json = getWorkbookJSONFromDesigner(designer);
const excelIO = new ExcelIO.IO();
return new Promise((resolve, reject) => {
excelIO.save(
json,
(blob: Blob) => resolve(blob),
(error: any) => reject(error),
);
});
};
const excelBlob = await getExcelBlobFromDesignerJSON(designer);
const file = new File([excelBlob], fileName);