Output_After_Skipping_Blank_Sheet1.zip (124.9 KB)
Output_Before_Skipping_Blank_Sheet1.zip (160.3 KB)
I have attached reference file above
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(filePath);
// Get the count of the worksheets in the workbook
int sheetCount = workbook.Worksheets.Count;
// Make all sheets invisible except first worksheet
for (int i = 1; i < workbook.Worksheets.Count; i++)
{
workbook.Worksheets[i].IsVisible = false;
}
// Take Pdfs of each sheet
for (int j = 0; j < workbook.Worksheets.Count; j++)
{
Aspose.Cells.Worksheet ws = workbook.Worksheets[j];
if (ws.Cells.Count > 0)
{
string ouputPath = outputFilePath + "worksheet-" + ws.Name + ".out1.pdf";
workbook.Save(ouputPath);
convertedPdfList.Add(ouputPath);
if (j < workbook.Worksheets.Count - 1)
{
workbook.Worksheets[j + 1].IsVisible = true;
workbook.Worksheets[j].IsVisible = false;
}
}
}
Above is code after skipping blank sheet, it returns wrong output…
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(filePath);
// Get the count of the worksheets in the workbook
int sheetCount = workbook.Worksheets.Count;
// Make all sheets invisible except first worksheet
for (int i = 1; i < workbook.Worksheets.Count; i++)
{
workbook.Worksheets[i].IsVisible = false;
}
// Take Pdfs of each sheet
for (int j = 0; j < workbook.Worksheets.Count; j++)
{
Aspose.Cells.Worksheet ws = workbook.Worksheets[j];
string ouputPath = outputFilePath + "worksheet-" + ws.Name + ".out1.pdf";
workbook.Save(ouputPath);
convertedPdfList.Add(ouputPath);
if (j < workbook.Worksheets.Count - 1)
{
workbook.Worksheets[j + 1].IsVisible = true;
workbook.Worksheets[j].IsVisible = false;
}
}
Source code before skipping blank sheets
Please check, Why after skipping blank sheets return wrong output of pdf file
Thanks
Satyendra Kumar