Free Support Forum - aspose.com

Dynamic Print Area set for Aspose Excel Template

Hi,

Is there any way to put dynamic print area set up based on data avilable in sheet?

can we do this with Aspose smart markers? or can we restict to print or Hide entire sheet if a condition fails?

I have attached a template. if my LC currecy is USD then we do not required USD tab or USD should show blank.

We can show blank by restict in database query but issue is with print area. even if we show blank it comes under print,

Please advise on this resolution

help is much appreciated

Thanks

Hi,

Is there any way to put dynamic print area set up based on data avilable in sheet?

Well, you may set your specified print areas dynamically using the api e.g
worksheet.PageSetup.PrintArea = “A1:C40,D1:F40”;
See the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-print-options.html


can we do this with Aspose smart markers? or can we restict to print or Hide entire sheet if a condition fails?

I have attached a template. if my LC currecy is USD then we do not required USD tab or USD should show blank.

Well, you can do it both ways. If, in a worksheet, you want to delete the blank rows/columns for invalid/irrelevant smart markers, you may preserve the markers first using the overloaded version of the Process method e.g WorkbookDesigner.Process(bool isPreserved) --- to retain/preserve the irrelevant smart, you will put true for this parameter. Now find/search those marker cells using the Aspose.Cells for .NET APIs, see the document: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/find-or-search-data.html After this, you will get the found cell's row/column and finally delete those rows/columns using the apis based on the row/column indexes, see the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/insertingdeleting-rows-and-columns.html

Moreover, to hide a complete worksheet (you can also remove the worksheet if you want too), you can use the api, see the document: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/hide-or-unhide-a-worksheet.html

Also, you may hide/unhide the rows/columns too, see the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/hidingunhiding-rows-and-columns.html


Hope this helps a bit.

Thank you.