Free Support Forum - aspose.com

Remaining Smart Markers are never removed

I’m writing an application using VB and Smart Markers. One of the last steps is to Process the markers and hopefully remove any Unused ones.

I’m including a simplified version of my source code. Could someone explain why the Unused smart markers still remain in the rendered spreadsheet?

Thanks.
Lynn

I don’t see your sample code.

How do you called Process method?

If you call:

designer.Process()
or
designer.Process(false)

Unused smart markers will be removed.

However, if you call:
designer.Process(true)

Unused smart markers will be preserved.

Sorry about the missing attachment. I used the ‘attachment’ button on your web site rather than pasting the text into the email. Perhaps someone needs to look into this and see that attachments are still working.

Anyway, here is the missing sample VB code. I believe that I am calling the Process(false) method. Anything stand out as wrong?

thanks.
Lynn
=============================================
’ populate the dataset from the database
VoltElementDataAdapter.SelectCommand.Parameters("@LotId").Value = iLotId
VoltElementDataAdapter.Fill(DataSet11)

'Open a designer file
Dim sTemplateFile As String = MapPath(“Resources/Files”) + “/VoltSummaryTemplate.xls”
Dim oExcelDesigner As ExcelDesigner = New ExcelDesigner
oExcelDesigner.Open(sTemplateFile)

’ replace some singletons
oExcelDesigner.SetDataSource(“FullLotCode”, “Some string”)) ’ define &=$FullLotCode replacements

’ Define data from the dataset
oExcelDesigner.SetDataSource(DataSet11) ’ define &=Table.Field replacements

’ Process all of the smart markers in all worksheets & REMOVE ANY REMAINING &= smart markers!
oExcelDesigner.Process(False) ’ remove un-replaced markers

’ send the spreadsheet to the browser
oExcelDesigner.Save(“Results.xls”, SaveType.OpenInBrowser, FileFormatType.Default, Response)




Could you please post those unremoved smart markers here?

Please check http://www.aspose.com/Wiki/default.aspx/Aspose.Excel/SmartMarker.html for reference.

Not all strings starting with "&=" are smart markers. Only following listed markers are treated as smart markers:

&=DataSource.FieldName

&=[Data Source].[Field Name]

&=$VariableName

&=$VariableArray

&==DynamicFormula

&=&=RepeatDynamicFormula


So if you set "&=Test", Aspose.Excel will not process it as a smart marker.

I’m using the &=Table.Field form, however, in these cases the dataset is returning zero rows on the select.

When there are zero rows returned, the Smart Markers are not being cleaned up (I think?).

Lynn

Hi Lynn,

Please download and try the latest hotfix at http://www.aspose.com/Products/Aspose.Excel/Downloads.html.

Bingo!
The latest hotfix fixed the problem of smart markers NOT being removed in the case that zero records were returned for markers like &=Table.Field

lynn