Cells grey when xlsx file is opened and saved

Hi,

when opening and saving the attached xlsx file with Aspose.Cells the cells marked with “X” are grey and will not be printed.

Thanks in advance and best regards,
Stefan Rupp

Hi Stefan,


Thank you for contacting Aspose support.

We have checked your provided sample against latest version of Aspose.Cells for .NET 8.1.1.1, and we are unable to spot a difference between input and output spreadsheets. We would request you to please give the latest version a try on your end. In case the problem persists, please provide more details of your scenario and a few snapshots to highlight the issue.

Hi,


Thanks for the template file.

I think you are talking about the range of cells: A39:D52. Well, actually in your Excel file, there is a printable area set “A1:G38” (check PageSetup|Sheet tab), so it will render the page within that range, you may confirm it taking the print preview of the sheet in MS Excel manually.

I think you may either remove the printable area manually in MS Excel before using Aspose.Cells or even using Aspose.Cells to specify the printable area accordingly, see the sample code for your reference:
e.g
Sample code:

var workbook = new Workbook(“e:\test2\12174.xlsx”);


// Get the Maximum row which contains data in the sheet
int maxdataRow = workbook.Worksheets[0].Cells.MaxDataRow;
int maxdatacol = workbook.Worksheets[0].Cells.MaxColumn;


workbook.Worksheets[“Übersicht”].PageSetup.PrintArea = “A1:” + CellsHelper.CellIndexToName(maxdataRow + 1, maxdatacol).ToString();
workbook.Save(“e:\test2\out1.xlsx”);

Hope, this helps a bit.

Thank you.

Hi,

setting the printing area accordingly solved the problem. Thank you for your quick reply and your help!

Best regards,
Stefan Rupp

Hi,


Good to know that your issue is resolved now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.