How to achieve Print Preview using Aspose.Cells

Hi,

I create a worksheet in memory to print, I am wondering wether I can see print preview before print it? Does Aspose support it ? If not, is there any workaround I can achieve this requirment?

Thanks,

Wei

Hi,

Well, Aspose.Cells is just a .NET component/library created in managed C# that does not have any interface. It is used to create, manipulate, render or convert MS Excel spreadsheets at every level, it provides APIs to perform almost all the tasks that MS Excel (97-2007/2010) provides. Well, Aspose.Cells allows you to directly print or navigate to printer to print MS Excel spreadsheets, see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Printing+Workbooks

Also, you may take the image of the sheet or render to PDF document, the image rendering or PDF rendering would be identical as per the print previews shown in Ms Excel, see the documents:
http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image
http://www.aspose.com/docs/display/cellsnet/Converting+to+PDF+Files

If you need to perform the manipulation of data in the cells visually in grid like environment or control, we have another set of controls:
Aspose.Cells.GridDesktop --> grid control for desktop application
Aspose.Cells.GridWeb --> grid control for web forms
For more information, see the demos for GridWeb:


Thank you.

Hi Amjad,



Thanks for your reply.



I consider to save worksheet as images first using WorksheetRender.ToImage(), then render the images in the PrintPreview dialog. but I have a problem with this approach, when I convert one worksheet to image, I only get one page converted to image, even there should be multiple pages output for one worksheet based on the page setup(for example, setup 2 pagetall/2 pagewide), how do I converted all of the pages to images.



Thanks,

Wei

Hi,


Sure, you may accomplish your task i.e. render all the pages of the sheet to save to image files, see the document / article for your reference:
http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image+and+Worksheet+to+Image+by+Page#ConvertingWorksheettoImageandWorksheettoImagebyPage-pages

You may loop through all the pages using SheetRender.PageCount API, see the example codes in the document.


Thank you.

The answer is very helpful. Thanks.

Hi,


Good to know that you have figured it out.

Feel free to contact us any time if you have further query or have another issue, we will be happy to assist you soon.

Thank you.