Skip to content

Commit 86f8455

Browse files
committed
chore(*): changed excel column min width
1 parent 3135532 commit 86f8455

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

projects/igniteui-angular/src/lib/services/excel/excel-exporter-options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export class IgxExcelExporterOptions extends IgxExporterOptionsBase {
4444
}
4545

4646
/**
47-
* Sets the width of the columns in the exported excel file. If left unspecified or 0,
48-
* the width of the largest string in the column will be used.
47+
* Sets the width of the columns in the exported excel file. If left unspecified,
48+
* the width of the column or the default width of the excel columns will be used.
4949
* ```typescript
5050
* this.exportOptions.columnWidth = 55;
5151
* ```

projects/igniteui-angular/src/lib/services/excel/excel-files.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ThemeFile implements IExcelFile {
5555
* @hidden
5656
*/
5757
export class WorksheetFile implements IExcelFile {
58-
private static MIN_WIDTH = 8.34;
58+
private static MIN_WIDTH = 8.43;
5959
private maxOutlineLevel = 0;
6060
private dimension = '';
6161
private freezePane = '';
@@ -115,7 +115,7 @@ export class WorksheetFile implements IExcelFile {
115115
let widthInTwips = worksheetData.options.columnWidth !== undefined ?
116116
worksheetData.options.columnWidth :
117117
Math.max(((width / 96) * 14.4), WorksheetFile.MIN_WIDTH);
118-
if (widthInTwips === 0 || widthInTwips === null) {
118+
if (!(widthInTwips > 0)) {
119119
widthInTwips = WorksheetFile.MIN_WIDTH;
120120
}
121121

@@ -181,7 +181,7 @@ export class WorksheetFile implements IExcelFile {
181181
let widthInTwips = worksheetData.options.columnWidth !== undefined ?
182182
worksheetData.options.columnWidth :
183183
Math.max(((width / 96) * 14.4), WorksheetFile.MIN_WIDTH);
184-
if (widthInTwips === 0 || widthInTwips === null) {
184+
if (!(widthInTwips > 0)) {
185185
widthInTwips = WorksheetFile.MIN_WIDTH;
186186
}
187187

projects/igniteui-angular/src/lib/services/excel/test-data.service.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export class FileContentData {
346346
`<tableColumn id="1" name="value"/></tableColumns>`;
347347

348348
this._worksheetData = `<dimension ref="A1:A4"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"></sheetView>` +
349-
`</sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><cols><col min="1" max="1" width="8.34" ` +
349+
`</sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><cols><col min="1" max="1" width="8.43" ` +
350350
`customWidth="1"/></cols><sheetData><row r="1"><c r="A1" t="s"><v>0</v></c></row><row r="2"><c r="A2" t="s"><v>1</v>` +
351351
`</c></row><row r="3"><c r="A3" t="s"><v>2</v></c></row><row r="4"><c r="A4" t="s"><v>3</v></c></row></sheetData>`;
352352

@@ -611,11 +611,10 @@ export class FileContentData {
611611
wsDataColSettings =
612612
`<cols><col min="1" max="1" width="200" customWidth="1"/></cols>`;
613613
break;
614-
case undefined:
615614
case null:
616615
case 0:
617616
wsDataColSettings =
618-
`<cols><col min="1" max="1" width="8.34" customWidth="1"/></cols>`;
617+
`<cols><col min="1" max="1" width="8.43" customWidth="1"/></cols>`;
619618
break;
620619
}
621620

0 commit comments

Comments
 (0)