How to unhide very hidden sheets and print gridlines and few more settings while converting to pdf

Hi,

Using Aspose i am converting excel to pdf and i need few settings to be done while converting.

how do i unhide the very hidden work sheets
print gridlines while converting to pdf.
Clear the print area
Apply autofilters
Unhide Windows

How do i get these option while converting excel to pdf

@pradeepdone,

Thanks for your query.

  1. Worksheet.VisibilityType can be used to unhide the very hidden worksheets.

  2. PageSetup.PrintGridlines property can be used to print the gridlines.

  3. Set PageSetup.PrintArea property to empty to clear the print area.

  4. Use Worksheet.AutoFilter option to apply autofilters.

  5. Please explain what do you mean by unhide Windows?

Please give a try to the following sample code and provide your feedback.

Workbook wb = new Workbook("Book1.xlsx");
Worksheet worksheet = wb.Worksheets[0];
wb.Worksheets[1].VisibilityType = VisibilityType.Visible;
wb.Worksheets[2].VisibilityType = VisibilityType.Visible;
wb.Save("Book1SavedToVisibleVeryHiddenSheets.xlsx");
Aspose.Cells.PdfSaveOptions options = new Aspose.Cells.PdfSaveOptions(Aspose.Cells.SaveFormat.Pdf);
options.GridlineType = GridlineType.Hair;
//Worksheet worksheet = workbook.Worksheets[0];

Aspose.Cells.PageSetup pageSetup = worksheet.PageSetup;

// Specifying the cells range (from A1 cell to E30 cell) of the print area
//COMMENT FOLLOWING LINE TO CLEAR THE PRINT AREA
pageSetup.PrintArea = "A1:E30";

// Allowing to print gridlines
pageSetup.PrintGridlines = true;

// Creating AutoFilter by giving the cells range
worksheet.AutoFilter.Range = "A1:A21";

// Initialize filter for rows containing string "2"
worksheet.AutoFilter.Custom(0, FilterOperatorType.Contains, "2");

//Refresh the filter to show/hide filtered rows
worksheet.AutoFilter.Refresh();

// Save the workbook
wb.Save("outputSettingPrintingOptions.pdf",options);

You may download the sample data from the following link.