Following an update to Aspose, our clients are encountering an error when exporting a large number of columns (over 100).
On the previous version, the export worked by clipping the columns at whatever fitted on the page.
Now however, the export fails and gives the following error:
Specified argument was out of the range of valid values. Parameter name: firstColumn
@William.armstrong
Would you please share some sample code snippet that is being used along with some sample source file so that we can try to replicate the issue in our environment and address it accordingly.
Hello asas.ali,
Neither of the following save methods are working, I’ve included the respective error messages below.
// Save to PDF - Error = "Specified argument was out of the range of valid values. Parameter name: firstColumn"
public void SaveAsPDF(string fileName) {
Aspose.Words.Document document = GenerateDocument();
PdfSaveOptions saveOptions = new PdfSaveOptions();
document.Save(fileName, saveOptions);
}
// Save to Doc - Error = "More than 63 cells per row is not supported for this file format."
public void SaveDoc(string fileName) {
Aspose.Words.Document document = GenerateDocument();
document.Save(fileName);
}
The attachment below shows the data we are exporting with some columns removed to bypass the errors.
Reduced columns.docx (14.6 KB)
Kind regards, Will
@William.armstrong
It looks like the inquiry is related to Aspose.Words. We are moving your inquiry to the respective forum where you will be assisted accordingly.
@William.armstrong Please note that the 2 messages you are receiving are not errors; they are warnings. However, rest assured that the document is saved properly using the latest version of Aspose.Words API (v23.5.0).
Thanks for your reply,
I have just tested upgrading to 23.5 and the issue remains the same.
It’s worth me stating again that the sample data file I provided has columns removed to be able to save it as a file because our data is created programmatically and is therefore difficult to upload a sample.
Kind regards, Will
@William.armstrong Could you please provide a simplified version of the code that you use to generate the conflicting documents? This will allow us to reproduce the issue and provide you with appropriate assistance.
Hi Eduardo,
This method replicates a very simple version of the data which should help you replicate the error:
private Document GenerateMockDocument() {
DocumentBuilder docBuilder = new DocumentBuilder();
docBuilder.StartTable();
for (int i = 0; i < 150; i++) {
docBuilder.InsertCell();
docBuilder.Write(i.ToString());
}
docBuilder.EndRow();
docBuilder.EndTable();
return docBuilder.Document;
}
If you change the “150” to anything below 63, it works ok.
Kind regards, Will
1 Like
@William.armstrong I was able to replicate the issue you described. However, please note that MS Word application also has a maximum limit of 63 columns in tables in order to render them correctly. Aspose.Words API aims to replicate the behavior of MS Word, so this limitation is expected.