question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export column width sets on wrong column, when export to excel

See original GitHub issue

I’m submitting a Bug report

Your Environment

Software Version(s)
Aurelia 1.31
Aurelia-Slickgrid 3.1.0
TypeScript 3.5.2
Operating System Windows 10
Node 10.15.3
NPM 6.4.1

Context

I try to setup export to excel, and also set export width for columns.

Expected Behavior

Title should get excel width on 50 point, when exporting.

Current Behavior

Screenshot_127 Title get default width on “8.43 points” in excel, when exporting. Screenshot_126 But next column Duration gets 49.29 points, so it seems like width are of one column.

Possible Solution

What I can see when console.log out sheet from customExcelHeader, some extra header styles (mark with red in image) is set before the real ones. Which makes all columns styles be of one column I think. Screenshot_129

Code Sample

this.columnDefinitions1 = [
 { id: 'title', name: 'Title', field: 'title', sortable: true, minWidth: 100, exportColumnWidth: 50 },
 { id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true, minWidth: 100 },
 { id: '%', name: '% Complete', field: 'percentComplete', sortable: true, minWidth: 100 },
 { id: 'start', name: 'Start', field: 'start', formatter: Formatters.dateIso },
 { id: 'finish', name: 'Finish', field: 'finish', formatter: Formatters.dateIso },
 { id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', sortable: true, minWidth: 100 }
];
this.gridOptions1 = {
  enableAutoResize: false,
  enableSorting: true,
  enableExcelExport: true,
  registerExternalResources: [new ExcelExportService()]
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ghiscodingcommented, Jan 29, 2021

This is now fixed and released, however please note that you will have to update both Aurelia-Slickgrid v3.3.1 and all Slickgrid-Universal packages to 0.10.2 (there were some TS Typing changes that impacts both side).

1reaction
ghiscodingcommented, Jan 25, 2021

@Chibi86 ok I see the problem after testing that in any of the grid, what you were trying to say (I think) is that getGrouping() returns an array and just testing with if (grouping) is not sufficient, instead if should be if (Array.isArray(grouping) && grouping.length) { and after that it works as intended (as shown below).

I’ll push a fix soon, I was about to push a new version this week anyway.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

The column width is not the same when printed in Excel
When you print or preview a worksheet, the column widths fail to be printed or appear as they appear on the screen in...
Read more >
Excel export Column wrong format - Microsoft Community
In the code below I'm setting Column E format for currency, "$#,##0.00;-$#,##0.00", but for some reason when I open the excel export the ......
Read more >
auto adjust the column width after export the file - MSDN
This is just Excel doing it's default. The only way you could really control this would be to create an Excel workbook and...
Read more >
Adjusting column width of Exported Gridview to Excel ... - MSDN
I exported the gridview to excel spreadsheet in order to print out the excel spreadsheet. Is it possible to adjust the width of...
Read more >
Set cell width size for excel in export excel - MSDN - Microsoft
Hi,. Thanks for your quick reply.. but i need to set column width size, if strFormat is "Excel" , Not for "XML".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found