We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create Pdf from excel workbook and set colormode as grayscale

Hi,

I am wondering how to create a grayscale PDF from excel workbook.

In Aspose.Words, we have an option to set the color mode as grayscale but am not sure how to set it for excel.

The code I have so far:

var xlDoc = new Aspose.Cells.Workbook(filePath);
xlDoc.Save("aspose.pdf", Aspose.Cells.SaveFormat.Pdf);

Let me know.

Thanks

@Sri79,

Thanks for your query.

Well, you may try to use PageSetup.BlackAndWhite Boolean attribute to render the sheet in black and white. You got to loop through each sheet in the workbook to set the property to true before rendering to PDF:
e.g
Sample code:

..........
    //Get the first worksheet in the workbook.
     Worksheet sheet = workbook.Worksheets[0];
    sheet.PageSetup.BlackAndWhite = true;
..............

Hope, this helps a bit.

1 Like