Free Support Forum - aspose.com

GrayScaling issue in xlsx

Hi team

I am using following code snippet to grayscale each sheet of xlsx
Aspose.Cells.Workbook xlsx= new Aspose.Cells.Workbook(Root+“demoExcel.xlsx”);
Aspose.Cells.WorksheetCollection sheets = xlsx.Worksheets;
foreach(Aspose.Cells.Worksheet sheet in sheets)
{
sheet.PageSetup.BlackAndWhite = true;
}
xlsx.Save(Root + “new.xlsx”);

even though I am getting all sheets as it is in colored form

please find attached files for ur reference
Document.zip (18.6 KB)

@kotharib2,

Thanks for the template file and sample code.

Well, your output file “new.xlsx” is fine tuned as I checked. I think you misunderstand the “BlackAndWhite” option which simply takes effect when you print the sheet or renders to image/PDF file format. In other words, you may confirm if it takes effect by taking the print preview of the sheet in MS Excel manually. The print preview shows the sheet contents/data in black and white. See the screenshots for your output file for your reference:

Let us know if you still have any issue or confusion.

Okay

I missunderstood the black and white concept

my task is I want to grey scale whole xlsx document…

how to achieve that?

@kotharib2,

I do not think if there is any automatic option available in MS Excel which could convert colored contents to black and white on display. So, you have to manually convert each data including cell to your desired formatting. Aspose.Cells follows MS Excel standards and specifications, so if something is not done in MS Excel automatically, it might not be done by Aspose.Cells either. If you know any option/feature (in MS Excel) which could automatically convert the colored contents to gray scaling, let us know and we will check on how to do it via Aspose.Cells APIs.