Free Support Forum - aspose.com

Hide Tables in Aspose.pdf

I have a xml file that has 4 sections with a table in each, I need to hide 3 of the sections if there is no data available, how can I accomplish this?

Heres how my xml is laid out



In my .vb code the logic flows like this

For Each DataRow In activeStandRows

RptCtr = RptCtr + 1

Select Case RptCtr

Case 1

Case 2

Case 3

Case 4

End Select

Next

Thanks

Hi,

The simplest approach to doing this would be to implement code logic as follows:

Dim isSectionEmpty As Boolean()

isSectionEmpty = New Boolean(3) {True, True, True, True}

For Each DataRow In activeStandRows

RptCtr = RptCtr + 1

isSectionEmpty(RptCtr - 1) = False

Select Case RptCtr

Case 1

'

Case 2

'

Case 3

'

Case 4

'

End Select

Next

'Create a Pdf instance and bind the XML file to Pdf instance

Dim pdf1 As Pdf = New Pdf()

pdf1.BindXML("input.xml", Nothing)

'Go through all the sections disabling the empty ones

Dim i As Integer

For i = 0 To 3

pdf1.Sections(i).IsDisabled = isSectionEmpty(i)

Next

If you disable a section then it dosn't get rendered in the pdf.

Thanks.

thanks that was perfect, the only change in the loop to disable the sections start the index from 0 instead of 1.

thanks again