xlsx-template-ex icon indicating copy to clipboard operation
xlsx-template-ex copied to clipboard

Process blocks failed. Process values failed.

Open RW-DiefBell opened this issue 4 years ago • 6 comments

Hi! First of all, brilliant library! Exactly what I've been looking for and much better/faster than the alternatives.

I'm getting the following error messages when building from the template:

xlsx-template-ex: Process blocks failed. The cell range is invalid and will be skipped: Payroll - Daily Overview CellRange { top: 0, left: 0, bottom: 0, right: 0 } xlsx-template-ex: Process values failed. The cell range is invalid and will be skipped: Payroll - Daily Overview CellRange { top: 0, left: 0, bottom: 0, right: 0 }

It still creates the xlsx, but when I open it Excel says this:

We found a problem with some content in "test.xlsx". Do you want us to try to recover as much as we can? After clicking "Yes" Excel tells me that it's removed some unreadable data, and the spreadsheet works completely fine. Any idea what the issue could be?

My template:

Employee ID First Name Last Name Date
[[all|repeat-rows]]{{userId}} {{firstName}} {{lastName}} {{date}}|date

And the code:

const allDaysInfo = lastMonthTimesheets.map((lmt) => {
    return {
        userId: "Test ID",
        firstName: "Joe",
        lastName: "Bloggs",
        date: new Date()
    }
});

const buffer = await XlsxTemplate.xlsxBuildByTemplate({all: allDaysInfo}, "./ReportTemplates/PayrollTemplate.xlsx");
await fs.promises.writeFile("./test.xlsx", Buffer.from(buffer));

The mapping gives an array of length 8 and I've checked the objects are what are expected.

Thanks :)

RW-DiefBell avatar Sep 14 '20 16:09 RW-DiefBell

@RW-DiefBell Could you try to prepare your template in Google Spread Sheets, export it to XLSX file and try again. I've had similar issues when prepared the templates on Linux NON MS Office.

optimistex avatar Sep 14 '20 16:09 optimistex

I'll take a look shortly, weird issue if it is that though. Running Win 10 MS Office.

Unrelated, but you can escape the | in markdown tables by just doing \|

RW-DiefBell avatar Sep 15 '20 08:09 RW-DiefBell

Creating the template in Google Sheets has solved the issue. However if I then edit the XLSX (in this case, I was turning it into a table) I don't get the "Process blocks failed. Process values failed." warning, but Excel does have the popup about a problem with the content. Even though Excel has the warning, the table still works fine, though the banded formatting gets broken. Screenshot_47

RW-DiefBell avatar Sep 15 '20 10:09 RW-DiefBell

Also, using your Google sheets method is considerably faster, even when I do the table edit in Excel.

RW-DiefBell avatar Sep 15 '20 10:09 RW-DiefBell

How Excel fixes the sheet when using tables:

Removed Records: AutoFilter from /xl/tables/table1.xml part (Table)
Removed Records: AutoFilter from /xl/tables/table2.xml part (Table)
Removed Records: AutoFilter from /xl/tables/table3.xml part (Table)

Also, Excel JS can't open an XLSX file from Google Sheets if there's coloured formatting.

RW-DiefBell avatar Sep 15 '20 15:09 RW-DiefBell

@RW-DiefBell There under the hood the package exceljs. It should be updated, but I don't have enough time to fix conflicts.

If you could make a pull request, I'd release it.

optimistex avatar Sep 15 '20 18:09 optimistex