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

Free Support Forum - aspose.com

Show data based on condition

Hi, I need to show some data based on condition on my excel report template:

{IF {{&=Result.IsAvailable}} Header Text &=Result.Value }

How can I achieve this. Thanks in advance!

@preetia14 Could you please specify what Aspose product do you use? Also, please attach your input and expected output documents here for testing. We will check the issue and provide you more information.

Hello Alexey,

Thanks for your quick response.

I am using Aspose sheet template (.xlsx) file.Sample.png (2.1 KB)

So, in the attached image the column which is highlighted in yellow need to be displayed on some condition (may be flag called result.flag).

Is there any way I can write the way we implement on Apsose word , for eg:
<<if [result.flag] >><<[result.Address]>><> (something of this sort of marker code aspose sheet template, as my heading Address in the attached image is not being displayed form the code, it is written/ hardcoded in the aspose excel Template.

Thanks in Advance!

@preetia14 Looks like your request is related to Aspose.Cells. I will move it to the appropriate forum and My colleagues from Aspose.Cells team will help you shortly.

@preetia14,

May be you could use Smart Markers dynamic formulas (see the document for your reference). You may insert some hidden column before your mentioned field where you will get the result/value (for each record) dynamically. You will write marker next to that hidden column in the format like: “&=&=IF(B{r}...)” . Also, as requested earlier, could you please provide sample Excel file, i.e., input Excel file, your expected output Excel file. We will check it further.

Input.png (3.8 KB)
Output.PNG (2.9 KB)
Hello Amjad,
Thanks for your response!
I need the column address to be shown on some conditional flag value, ie. if the flag value is true which is coming from the datasource , I will show the Address field else I will hide it.

So, I need something which can handle the condition on flag to show the Address field(some if marker to handle the same on aspose template side).

I have added the input and required output images.

Thanks,
Preeti

@preetia14,

How do you evaluate the conditional flag? Do you retrieve in some cell in Excel sheet or you evaluate it in code (after you manually retrieve the flag value from database/table)? We still could not receive your sample Excel files. Please do provide your input Excel file and your expected two Excel files (one file with “true” flag showing Address and other with “false” which is hiding the “Address” field). Also, please note, there is no concept of using marker fields in IF condition directly. So, you 'd better do it separately and manually. For example, after your markers are processed and data is filled with data, you may try to evaluate the condition in code whether to show Address value or not.