Skip to content

Commit 528ef41

Browse files
committed
Fixig excel design.
1 parent 998bcb5 commit 528ef41

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/ExcelService/ExcelService.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<OldRe
109109
var workbookPart = spreadsheetDocument.AddWorkbookPart();
110110
workbookPart.Workbook = new Workbook();
111111

112+
// Create Stylesheet for bold headers and date format
113+
var stylesPart = workbookPart.AddNewPart<WorkbookStylesPart>();
114+
stylesPart.Stylesheet = CreateStylesheet();
115+
stylesPart.Stylesheet.Save();
116+
112117
var sheets = workbookPart.Workbook.AppendChild(new Sheets());
113118

114119
foreach (var eformModel in reportModel)
@@ -133,16 +138,16 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<OldRe
133138
// Create header row
134139
var headerRow = new Row();
135140
headerRow.Append(
136-
ConstructCell(localizationService.GetString("Id"), CellValues.String),
137-
ConstructCell(localizationService.GetString("Property"), CellValues.String),
138-
ConstructCell(localizationService.GetString("SubmittedDate"), CellValues.String),
139-
ConstructCell(localizationService.GetString("DoneBy"), CellValues.String),
140-
ConstructCell(localizationService.GetString("ItemName"), CellValues.String)
141+
ConstructCell(localizationService.GetString("Id"), CellValues.String, 1),
142+
ConstructCell(localizationService.GetString("Property"), CellValues.String, 1),
143+
ConstructCell(localizationService.GetString("SubmittedDate"), CellValues.String, 1),
144+
ConstructCell(localizationService.GetString("DoneBy"), CellValues.String, 1),
145+
ConstructCell(localizationService.GetString("ItemName"), CellValues.String, 1)
141146
);
142147

143148
foreach (var itemHeader in eformModel.ItemHeaders)
144149
{
145-
headerRow.Append(ConstructCell(itemHeader.Value, CellValues.String));
150+
headerRow.Append(ConstructCell(itemHeader.Value, CellValues.String, 1));
146151
}
147152

148153
sheetData.AppendChild(headerRow);
@@ -204,6 +209,9 @@ public async Task<OperationDataResult<Stream>> GenerateExcelDashboard(List<OldRe
204209

205210
sheetData.AppendChild(dataRow);
206211
}
212+
213+
// Apply autofilter and table formatting
214+
ApplyTableFormatting(sheet, worksheetPart, sheetData);
207215
}
208216
}
209217

eform-client/cypress/e2e/plugins/backend-configuration-pn/a/420_eform-angular-items-planning-plugin.sql

Lines changed: 8 additions & 6 deletions
Large diffs are not rendered by default.

eform-client/cypress/e2e/plugins/backend-configuration-pn/a/backend-configuration-reports.downloads.spec.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ describe('Reports', () => {
6363
cy.wait('@downloadReport', { timeout: 90000 });
6464
const downloadedExcelFilename = path.join(downloadsFolder, `${fileName}.xlsx`);
6565
const fixturesExcelFilename = path.join(<string>fixturesFolder, `${fileName}.xlsx`);
66-
cy.task('readXlsx', {file: fixturesExcelFilename}).then((file1Content) => {
67-
cy.task('readXlsx', {file: downloadedExcelFilename}).then((file2Content) => {
66+
cy.readFile(fixturesExcelFilename, 'binary').then((file1Content) => {
67+
cy.readFile(downloadedExcelFilename, 'binary').then((file2Content) => {
6868
//expect(file1Content, 'excel file').deep.eq(file2Content);
6969
const workbook1 = read(file1Content, { type: 'binary' });
7070
const sheetName1 = workbook1.SheetNames[0]; // Assuming you're comparing the first sheet
@@ -106,8 +106,8 @@ describe('Reports', () => {
106106
cy.wait('@downloadReport', { timeout: 90000 });
107107
const downloadedExcelFilename = path.join(downloadsFolder, `${fileName2}.xlsx`);
108108
const fixturesExcelFilename = path.join(<string>fixturesFolder, `${fileName2}.xlsx`);
109-
cy.task('readXlsx', {file: fixturesExcelFilename}).then((file1Content) => {
110-
cy.task('readXlsx', {file: downloadedExcelFilename}).then((file2Content) => {
109+
cy.readFile(fixturesExcelFilename, 'binary').then((file1Content) => {
110+
cy.readFile(downloadedExcelFilename, 'binary').then((file2Content) => {
111111
//expect(file1Content, 'excel file').deep.eq(file2Content);
112112
const workbook1 = read(file1Content, { type: 'binary' });
113113
const sheetName1 = workbook1.SheetNames[0]; // Assuming you're comparing the first sheet
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)