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

Free Support Forum - aspose.com

Patched version of aspose creates tiff with extra blank pages

We are using a patched version of Aspose.Cells (18.11.6) to convert an xlsx to tiff.

We find with this new version, what used to be converted to a 1 page tif, now converts to a 4 page tif. The older version was 18.10.0. There are extra blank pages at the end

Below is a zip with the original xlsx.
out.tif is the output with 18.11.6
Olderversionofaspose.tif is how 18.10.0 rendered the same xlsx with the code below.

Issue17-Original.zip (102.9 KB)


private void button1_Click(object sender, EventArgs e)
{
Aspose.Cells.License cellsLicense = new Aspose.Cells.License();
cellsLicense.SetLicense(“C:\interfax\Interfax20\OfficeRenderer\Service\License\Aspose.Total.lic”);

		Aspose.Imaging.License imagingLicense = new Aspose.Imaging.License();
		imagingLicense.SetLicense("C:\\interfax\\Interfax20\\OfficeRenderer\\Service\\License\\Aspose.Total.lic");

		int numPages = 0;
		var asposeWorkbook = new Aspose.Cells.Workbook("c:\\dtemp\\Issue17-Original.xlsx");

		numPages = asposeWorkbook.Worksheets.Count;

		Aspose.Cells.Worksheet selectedWS = null;
		selectedWS = asposeWorkbook.Worksheets[0];



		foreach (Aspose.Cells.Worksheet w in asposeWorkbook.Worksheets)
		{
			if (w.IsSelected)
			{
				bool anySelected = true;
				selectedWS = w;
				// rcalc cells size
				w.AutoFitRows(true);

				// recalc formulas
				foreach (Aspose.Cells.Cell cell in w.Cells)
				{
					try
					{
						if (cell.IsFormula)
							cell.Calculate(false, null);
					}
					catch { }
				}

				// recalc pivot tables
				foreach (Aspose.Cells.Pivot.PivotTable pt in w.PivotTables)
				{
					try { pt.RefreshData(); }
					catch { }
					try { pt.CalculateData(); }
					catch { }
					try { pt.CalculateRange(); }
					catch { }
				}

			}
			else
				//mark this worksheet as NOT saveable
				w.IsVisible = false;
		}


		bool flipresizeWS = false;
		Aspose.Cells.Rendering.ImageOrPrintOptions CellsSaveOptions = null;
		Aspose.Cells.Rendering.ImageOrPrintOptions cellRenderoptions = CellsSaveOptions;

		if (cellRenderoptions == null)
		{
			Aspose.Cells.PageSetup setup = selectedWS.PageSetup;

			int horizDpi = 170;
			int vertDpi = 170;
			flipresizeWS = setup.Orientation == Aspose.Cells.PageOrientationType.Landscape;
			cellRenderoptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
			// Set Horizontal Resolution
			cellRenderoptions.SaveFormat = Aspose.Cells.SaveFormat.TIFF;
			cellRenderoptions.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT3;

			// Set Vertical Resolution
			cellRenderoptions.VerticalResolution = vertDpi;
			cellRenderoptions.HorizontalResolution = horizDpi;
			cellRenderoptions.Quality = 100;
			cellRenderoptions.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
			cellRenderoptions.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppArgb;

			// If you want entire sheet as a single image
			cellRenderoptions.OnePagePerSheet = false;


			// Render to image
			Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(selectedWS, cellRenderoptions);
			sr.ToTiff("c:\\dtemp\\out.tiff");
		}
	}

@danwise,

Thanks for your query.

I have tried this scenario using latest version Aspose.Cells for .NET 18.11.7, 18.10.0 and even older versions but all of them are creating similar TIFF file containing 4 pages. Could you please share the exact version which you found working correct? It will be helpful for us to compare the results and share our feedback.

Our QA department was the one that mentioned older versions of the software produced only one page.

I took their word on it. They might have been mistaken as I can’t reproduce either with the version I mentioned.

But it is producing 2 blank pages at the moment where print preview in excel shows 2. Can we investigate why that is?

@danwise,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46511 - TIFF created with extra blank pages

@danwise,

The sheet print quality is 300dpi (see Worksheet.PageSetup.PrintQuality), for the printer which supports 300dpi, it will printview 2 pages(see “Adbobe PDF printer.png”), but for the printer which does not support 300dpi, it will print 1 page (see “Microsoft Print to PDF printer.png”).

If you manually save the file to PDF by “Microsoft Excel Save as”, the generated PDF file is also 1 page(see “Issue17-Original_Ms.pdf”). So we will fix the issue to generate one page file.

Issue17-Original_Ms.pdf (293.8 KB)
Adbobe PDF printer.png (92.9 KB)
Microsoft Print to PDF printer.png (89.9 KB)

ok let me know when that becomes available.

Thanks!

@danwise,

Please spare us little time (5-7 days initially). Once we figure it out, we will update you.

of course. Thankyou!

@danwise,

This is to inform you that we have fixed your issue “CELLSNET-46511” now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@danwise,

Please try our latest version/fix: Aspose.Cells for .NET v18.12.2:

Aspose.Cells18.12.2 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.12.2 For .Net4.0.Zip (4.7 MB)

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-46511) have been fixed in Aspose.Cells for .NET v19.1. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi