When using Spire.XLS, there are multiple sheets, and the page orientations are both horizontal and vertical. However, only one orientation is used when printing. How can I set different paper orientations for different sheets when printing?
The following does not work:
sheet = workbook.Worksheets[1];
pageSetup = sheet.PageSetup;
pageSetup.Orientation = PageOrientationType.Portrait;
sheet = workbook.Worksheets[2];
pageSetup = sheet.PageSetup;
pageSetup.Orientation = PageOrientationType.Landscape;
PrintDialog dialog = new PrintDialog();
dialog.UserPageRangeEnabled = true;
PageRange rang = new PageRange(1, 3);
dialog.PageRange = rang;
PageRangeSelection seletion = PageRangeSelection.UserPages;
dialog.PageRangeSelection = seletion;
if (dialog.ShowDialog() == true)
{
workbook.PrintDocument.Print();
}