Free Support Forum - aspose.com

Aspose Licence issue-More than one file

Hi Team,

We have a valid Aspose license.i am converting from AsposeGridWeb to excel file using .NET.I am able to convert AsposeGridWeb to excel file in one.aspx.cs file using the below code and excel file contains data as well but i am not able to convert AsposeGridWeb to excel file in second.aspx.cs and sheet contains only the below copyright waring message, not data.Both apsx.cs files are in same solution.

We need to convert AsposeGridWeb to excel file in different aspx.cs file.So please provide the solution for this issue.

Used Code:

Aspose.Cells.License license = new Aspose.Cells.License();

license.SetLicense("Aspose.Total.lic");

TestGrid.WebWorksheets.SaveToExcelFile(@"C:\Test5.xls");

EVALUATION COPYRIGHT WARNING
This file is created using EVALUATION VERSION of Aspose.Cells.GridWeb.
Evaluation Limitations:
This EVALUATION LICENSE WARNING worksheet will be added to all web pages created with Aspose.Cells.GridWeb.
The usage of this Evaluation Version in any Commercial Application is strongly PROHIBITED.
Any Violation to the Usage Policies of this Product shall require a mandatory purchase of pay license as well as expose the user to other legal recourse for collection and punitive damages.
Copyright 2004 - 2013 Aspose Pty Ltd.

Thanks and Regards

Saravanan.l

Hi,


This is not an issue with our product by any means, rather on your second page, your licensing code is not run/executed, so consequently the evaluation watermark sheet is added to your output file. Also, by the way, seeing your code snippet a bit:
i.e.

Aspose.Cells.License license = new Aspose.Cells.License();

license.SetLicense(“Aspose.Total.lic”);


it looks obvious that you do not set your license for Aspose.Cells.GridWeb control separately. So, please add lines to set license for Aspose.Cells.GridWeb control also if you are using Aspose.Cells.GridWeb APIs too, e.g

Aspose.Cells.GridWeb.License glicense = new Aspose.Cells.GridWeb.License();

glicense.SetLicense(“Aspose.Total.lic”);

We strongly recommend you to kindly add all your licensing code (for both Aspose.Cells library and Aspose.Cells.GridWeb control) in Application_Start event instead of Page_Load, see the document for your complete reference (read the complete topic):
http://www.aspose.com/docs/display/cellsnet/Licensing

Thank you.

Hi

Thanks for your reply.I am getting below error in another page while converting from asposeGridWeb to excel file.

"A workbook must contain at least a visible worksheet"

Also please provide code for convert few tabs from asposeGridWeb to excel file instead of entire asposeGridWeb.

Thanks and Regards

Saravanan.l

Hi,


Aspose.Cells.GridWeb is not efficient to save to PDF format, you should use Aspose.Cells library for it, it is reliable and can convert the Excel file to PDF with highest fidelity:
http://www.aspose.com/docs/display/cellsnet/Converting+to+PDF+Files

I think you may first save your file into MemoryStream using this.GridWeb.WebWorksheets.SaveToExcelFile and then from there convert your file into PDF using Aspose.Cells for .NET API(s)

And, you may hide your unwanted worksheets before converting to PDF.

Thank you.

Hi Team,

Thanks for your reply.Please provide sample code for convert few sheets from AsposeGridWeb to excel file instead of saving all sheet.

Example:

AsposeGridWeb contains 10 sheets but i need to save only 5 sheets to excel file using this.GridWeb.WebWorksheets.SaveToExcelFile

Thanks and Regards

Saravanan.l

Hi,


Well, in latest version of Aspose.Cells.GridWeb v2.7.14.2000 (you may get it by installing the latest Aspose.Cells for .NET v7.3.5 MSI installer), we have supported more file formats for conversion e.g PDF, ODS, Tab Delimited, HTML etc. So, one can directly save the GridWeb to PDF for other formats.

Now for your needs, I think you may remove your unwanted worksheets by using WebWorksheets.RemoveAt() method and then use SaveToExcelFile() method of GridWeb to render your desired worksheets data in the PDF.
See the sample code below that works fine.

Sample code:

//Suppose you don’t need Sheet2 in the output PDF. Remove that sheet, you may repeat this step to
//remove your unwanted sheets.
GridWeb1.WebWorksheets.RemoveAt(“Sheet2”);
GridWeb1.WebWorksheets.SaveToExcelFile(“e:\test2\output.pdf”, Aspose.Cells.GridWeb.Data.FileFormatType.PDF);


Thank you.

Hi Team,

Thank you!.i have used the above code and converted into PDF.but Pdf contains not proper alignment.

Example Excel file contians 20 columns and many rows but converted PDF file showing 3 colums in one page remaing showing after end of the rows.We need to show all the columns in one page wise.Please find the attachemnt for your reference.

Please provide the sample code for hide and protect the sheets from AsposeGridWeb.Because Our requirement is we need to hide and protect the few sheet from AsposeGridWeb.

Thanks and Regards

Saravanan.l

Hi,

Saravananl:

Example Excel file contians 20 columns and many rows but converted PDF file showing 3 colums in one page remaing showing after end of the rows.We need to show all the columns in one page wise.Please find the attachemnt for your reference.


Excel rendering to PDF (by Aspose.Cells for .NET) is based on the print preview for worksheets that you could see them in Ms Excel. When I take the print previews of the first sheet, it also does show the same view as per your rendered PDF file, you may confirm it in Ms Excel using its print preview (it also shows 3 columns per page), so no issue at all regarding our product. I think if you are using Aspose.Cells library, then you may accommodate your needs to some extent. Moreover, you may play upon Page Setup options of MS Excel to check this, if you are placing all the columns on a single page, then the data would be very tiny and hard to read by you. So, apparently, you may use some try some PageSetup options, e.g Fit to pages wide --> 1 and also you may set the orientation to Landscape, see the lines of code:

worksheet.PageSetup.Orientation = PageOrientationType.Landscape;

worksheet.PageSetup.FitToPagesWide = 1;

(no need to specify for fit to pages tall option, it should be blank).

Now render to PDF, and you will get some fruitful results for your needs.

See the topic for your reference:

http://www.aspose.com/docs/display/cellsnet/Setting+Page+Options

Note: above is only possible by Aspose.Cells and not by Aspose.Cells.GridWeb.


Saravananl:

Please provide the sample code for hide and protect the sheets from AsposeGridWeb.Because Our requirement is we need to hide and protect the few sheet from AsposeGridWeb.


1) To hide worksheet in GridWeb is not possible, you may use WebWorksheets.RemoveAt() method. Alternatively you may use Aspose.Cells API, see the topic:

http://www.aspose.com/docs/display/cellsnet/Hide+or+Unhide+a+Worksheet


2) You may protect a worksheet in GridWeb grid matrix by GridWeb control, but I suspect when you import/export from/to Excel, the protection would be excluded. This is a limitation of GridWeb control at the moment, see the demo:

http://www.aspose.com/demos/.net-components/aspose.cells/csharp/grid/common/data-validation.aspx


But, if you could use Aspose.Cells component, you may do it, see the topics:

http://www.aspose.com/docs/display/cellsnet/Security+Features


Thank you.