plz help me.
My flow:
Using a file Tempate -> Code (Exceljs) -> output New file
Template file:
Center on page:
Source coder:
worksheet.pageSetup.horizontalCentered = true
worksheet.pageSetup.verticalCentered = true
BUT File output:
ExcelJS is a JavaScript library for reading, manipulating and writing spreadsheet data in XLSX format.
In addition, exceljs is frequently updated from time to time and available for free.
On the Format button's menu, select AutoFit Column Width and notice that the width of Column A has changed to contain the length of the text in the A1 cell. Unlike column widths, Excel automatically adjusts the height of a row to accommodate the height of the text that takes up the most vertical space in each row.
Please tell me if this worked well or not.
// DO NOT SET ANOTHER pageSetup AFTER DECLARING THIS!
var worksheet = workbook.addWorksheet('sheet', {
pageSetup: {
horizontalCentered: true,
verticalCentered: true,
paperSize: 9,
orientation: 'portrait',
margins: {
left: 0.3149606, right: 0.3149606,
top: 0.3543307, bottom: 0.3543307,
header: 0.3149606, footer: 0.3149606
}
}
})
Please check below link and code.
https://github.com/Great-hijack/react-excel/blob/master/frontend/src/utils/export2excel.js
var sheet1 = workbook.addWorksheet('Download', { properties: { tabColor: { argb: '6B5B95' }, defaultRowHeight: 39 } });
// Page Setup for sheet1
sheet1.pageSetup.paperSize = 13; // B5 (JIS)
sheet1.pageSetup.orientation = 'landscape';
sheet1.pageSetup.horizontalCentered = true;
sheet1.pageSetup.verticalCentered = true;
sheet1.pageSetup.margins = {
left: 0.7, right: 0.7,
top: 0.3, bottom: 0.3,
header: 0.3, footer: 0.3
};
I hope this is helpful for you.
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