Hello,
There is an issue with exporting report data to excel. There is the string "Gra PS3 Command and Conquer: Red Alert 3 Ultimate Edition (pyta Blu-ray_x000D_ ) (0014633382556)" in report data and after export to excel it becomes:
The sequence of characters "_x000D_" is replaced by a newline.
I need the data to be exported as it is in the report. How I can do that?
Thanks
Hello, Alex!
Thank you for reaching out to us.
Our team has managed to reproduce the described exporting behavior on our side. We will get back to you with a fix with ETA December 23.
We will notify you about any updates on the matter.
Feel free to reach out to us in case of any other questions.
Kind regards,
Solomiia
Hello Solomiia,
Thank you for your prompt response and for confirming the issue. I appreciate your team's effort in working towards a fix and the update regarding the expected timeline.
I'll look forward to hearing back from you regarding any progress or changes.
Thank you once again for your support.
Kind regards,
Alex
Hello, Alex!
Thank you for your kind words.
Our team will notify you as soon as the fix is ready.
Feel free to contact us if any other questions arise.
Best regards,
Solomiia
Hello, Alex!
Hope you are doing well.
Our team is happy to inform you that the issue with trimming sequences like _x000D_
in Excel export was fixed.
The fix is available from the 2.9.93
version of Flexmonster: https://www.flexmonster.com/release-notes/version-2-9-93/.
You are welcome to update the component: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
Please let us know if the fix works well for you.
Kind regards,
Solomiia
Hello, Alex!
Hope you are doing well.
Our team is wondering if you had some time to check the fix. Please let us know if it works well for you.
Looking forward to hearing your feedback.
Kind regards,
Solomiia
Hi Solomiia,
Thank you for following up!
Unfortunately, after updating to v2.9.94 the issue persists on my end. Could you please take another look?
I’m happy to provide more details or screenshots if needed to help troubleshoot further.
Looking forward to your guidance.
Kind regards,
Alex
Hi Solomiia,
I double-checked the issue and found that problem appears when the callbackHandler parameter is used. In my case callbackHandler is used to display url strings as hyperlinks.
this.pivot.flexmonster.exportTo(
'excel',
{
filename: `report`,
excelSheetName: 'Sheet1',
destinationType: 'plain'
},
(result: any) => {
let workbook = new ExcelJS.Workbook();
workbook.xlsx.load(result.data.buffer).then((workbook) => {
workbook.eachSheet((sheet) => {
sheet.eachRow((row) => {
row.eachCell((cell) => {
let value = cell.value.toString();
if (this.isValidUrl(value)) {
cell.value = { formula: `HYPERLINK("${value}", "${value}")` };
cell.style = JSON.parse(JSON.stringify(cell.style)); // workaround for issue 'cell font styling is applied to entire sheet' https://github.com/exceljs/exceljs/issues/879
cell.font = { ...cell.font, underline: true, color: { theme: 10 } };
}
});
});
});
workbook.xlsx.writeBuffer().then((buffer) => {
FileSaver.saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'report.xlsx');
});
});
}
);
When the data is exported without using the callbackHandler, everything works as expected and the sequence of characters "_x000D_" is not replaced.
this.pivot.flexmonster.exportTo(
'excel',
{
filename: `report`,
excelSheetName: 'Sheet1'
}
);
Could you please help me with solving the issue?
Kind regards,
Alex
Hello, Alex!
Thank you for getting back to us.
We have tested the provided data with the special symbol along with the provided callbackHandler
on our side, and we want to kindly mention that the symbol _x000D_
is converted to the newline in the callback handler code.
Our team suggests adding the following code to your callbackHandler
before exporting:
let value = cell.value.toString()
cell.value = value.replace(/(_x[0-9A-F]{4}_)/gmi, '_x005F$1');
Here is the JSFiddle to illustrate the idea: https://jsfiddle.net/flexmonster/aut2wmkx/.
Hope it helps. If there are further questions, please modify the provided JSFiddle to make the behavior reproducible.
Kind regards,
Solomiia
Hello Solomiia,
Thank you for your prompt response and the detailed explanation.
I implemented the suggested modification to the callback handler, and it worked perfectly! The issue has been resolved, and the data is now being processed as expected.
Thank you once again for your assistance!
Kind regards,
Alex
Hello, Alex!
Thank you for your feedback.
We are happy to hear that everything works well now.
Feel free to reach out to us in case of any other questions.
Kind regards,
Solomiia