0
votes

I am trying to implement Custom XML parts feature in Office js.

While creating custom XML part in Excel, I am getting a GeneralException while adding the XML part in workbook.

I am fetching data from excel having 5000 rows and 4 columns.

I am encoding the data using Base64 encoding and storing the data in a XML tag in the following format -

My encoded data.

Are there any size limitation while adding a custom XML part in the workbook ?Is there any specific behind this error?

Example:

Excel.run(function (ctx) {
    var xmlObj = "<data>My encoded data.</data>";
    var xmlPart = ctx.workbook.customXmlParts.add(xmlObj);
    return ctx.sync();
});
2
Could you provide an example of the code you're using and the data you're encoding? - Marc LaFleur
@MarcLaFleur-MSFT - I am using the following code to add the XML object to the workbook. Excel.run(function(ctx){ var xmlObj = Here goes my XML object; var xmlPart = ctx.workbook.customXmlParts.add(xmlObj); return ctx.sync(); }); - Arupam Sengupta
@MarcLaFleur-MSFT - I have tried to add the XML object without encoding, it is failing for the same threshold. - Arupam Sengupta

2 Answers

1
votes

Thanks for bringing this issue to our attention! I was able to repro the behavior on a blank workbook against excel.exe. It is due to a bug that we will try to fix in the nearest future. Sorry for the inconvenience. Please stay tuned for Excel updates.

0
votes

There is no size limitation as such. I'd recommend the following:

  1. Try with smaller number of rows.

  2. Make sure the final XML is valid (you could use online validation tool to make sure there are no special characters, etc. that's giving the error). Ideally the API should tell you if the XML is invalid... but worth double-checking.

  3. Is this happening only when you encode? Try using just regular string concatenation for the sake of testing. Please let us know where it fails in above tests.