Avoid rendering blank page in the output PDF when there is nothing to be printed and get HTML5 string from Cell using Aspose.Cells for .NET 18.4

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn


Aspose.Cells for .NET logo
We are pleased to announce the release of Aspose.Cells for .NET v18.4. Please check the document on how to install Aspose for .NET APIs directly from NuGet repository. In this release, we have added some worthy features and other enhancements for the users. Please check the release notes in order to get an idea about what is new and what has been enhanced or fixed with this revision of Aspose.Cells for .NET.

Avoid Blank Page in Output Pdf when there is Nothing to Print

When the Excel file is empty and user saves it to PDF using Aspose.Cells, it renders blank page in output PDF. Sometime, this default behavior is undesirable. Aspose.Cells provides the PdfSaveOptions.OutputBlankPageWhenNothingToPrint property to deal with this issue. If you will set it as false, then CellsException will occur whenever there is nothing to print in the output PDF.

//Create empty workbook.
Workbook wb = new Workbook();
 
//Create Pdf save options.
PdfSaveOptions opts = new PdfSaveOptions();
 
//Default value of OutputBlankPageWhenNothingToPrint is true.
//Setting false means - Do not output blank page when there is nothing to print.
opts.OutputBlankPageWhenNothingToPrint = false;
 
//Save workbook to Pdf format, it will throw exception because workbook has nothing to print.
wb.Save("output.pdf", opts);

Please see the following article for more detail on this topic for your reference.

Find Type of X and Y Values of Points in Chart Series

Sometime, you want to know the type of X and Y values of chart points in a series. Aspose.Cells provides ChartPoint.XValueType and ChartPoint.YValueType properties that can be used for this purpose. Please note, you will have to call Chart.Calculate() method before you could use these properties effectively. Please see the following article for more detail on this topic for your reference:

Get HTML5 string from Cell

Aspose.Cells returns the HTML string of the cell using the string GetHtmlString (bool html5) method. If you pass “false” as parameter, it will return you Normal HTML but if you pass “true” as parameter, it will return Html5 string. Please see the following article for more detail on this topic for your reference:


Hiding Overlaid Content with CrossHideRight while saving to Html

When you save your MS Excel file to HTML, you can specify different cross types for cell strings. By default, Aspose.Cells generates HTML as per Microsoft Excel but when you change cross type to CrossHideRight then it hides all the strings from the right side of the cell which are overlaid or overlapping with cell string. Please see the following article for more detail on this topic for your reference:


Specify the Language of the Excel File using Built In Document Properties

You can change the Language of MS Excel file by right clicking the file and then selecting Properties > Details and then editing the Language field. Please use BuiltInDocumentPropertyCollection.Language property to change it programmatically using Aspose.Cells APIs. Please see the following article for more detail on this topic for your reference:

Create Chart PDF with Desired Page Size

You can create chart’s PDF file with your desired page size using Aspose.Cells and specify how you want to align the chart inside the page as top, bottom, center, left, right etc. Besides this, the output chart can be created in stream or on disk. Please see the following article for more detail on this topic for your reference:

Get All Hidden Rows Indices after Refreshing AutoFilter

When you apply auto filter on worksheet cells, then some of the rows get hidden automatically. But it might be the case that some of the rows are already hidden manually by MS Excel end user and they are not hidden by auto filter feature. It therefore makes difficult to know which of the rows are hidden by auto filter and which rows are hidden manually by MS Excel end user. Aspose.Cells deals with this problem using the int[] AutoFilter.Refresh(bool hideRows) method. This method returns the row indices of all the rows that are hidden by auto filter and not by manual way in MS Excel. Please see the following article for more detail on this topic for your reference:

Rotate Text with Shape inside the Worksheet

You can add text inside any shape using Microsoft Excel. If you add shape using the older Microsoft Excel 2003, then text will not rotate with shape. But if you add shape using newer versions of Microsoft Excel e.g. 2007, 2010, 2013 or 2016 etc. then text will be rotated with shape. You can control if the text should rotate with shape or not using the ShapeTextAlignment.RotateTextWithShape property. Please see the following article for more detail on this topic for your reference:

Read/Write TSV (Tab-Separated Values) Files 

Tab-Separated Values (TSV) file (similar to Tab Delimited) contains spreadsheet data but without formattings. Aspose.Cells does support to read and write TSV file format type, it includes relevant member (TSV) in both LoadFormat and SaveFormat Enumerations. See the following sample code for your reference.

string dataDir = "e:\\test2\\";

LoadOptions loadOptions = new LoadOptions(LoadFormat.TSV);

// Create a Workbook object and opening the file from its path
Workbook wbTSV = new Workbook(dataDir + "Book1TSVfile.tsv", loadOptions);
Console.WriteLine("TSV file opened successfully!");

//Save the file
wbTSV.Save("e:\\test2\\out1.tsv", SaveFormat.TSV);

Please see the following article for more detail on this topic for your reference.

Aspose.Cells for .NET Resources

The resources, you may need to accomplish your tasks:


To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply