Free Support Forum - aspose.com

Smart Makers Not removed

I have a workbook with several sheets. Each sheet will contain the output of a dataview. However, if the dataview contains no rows it will not remove the smart markers. Even if I say false to preserve the markers. I can call "GetSmartMarkers" function or whatever it is called to get an array of smart markers, however the ones that relate to the dataviews with no rows do no show up in the array. I can manually add an empty row to any table with no rows (i pass the defaultview of the table), but this is not a feasable solution to an enterprise application. TIA. Sample code below

Dim cmd As New SqlClient.SqlCommand("usp_rptERBDetail")

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = startDate

cmd.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = endDate

Dim ds As DataSet = Database.Global.GetDataSet(cmd)

Dim xls As New Aspose.Cells.ExcelDesigner

Dim file As String = Server.MapPath("/LoanConnect/EnduringRelationship/Templates/Enduring Relationship Detail Report layout.xls")

xls.Open(file)

For Each table As DataTable In ds.Tables

If table.Rows.Count = 0 Then

table.Rows.Add(table.NewRow())

End If

Next

xls.SetDataSource("EIR", ds.Tables(0).DefaultView)

xls.SetDataSource("ERB", ds.Tables(1).DefaultView)

xls.SetDataSource("ERI", ds.Tables(2).DefaultView)

xls.SetDataSource("ERIP", ds.Tables(3).DefaultView)

xls.SetDataSource("ERBorrow", ds.Tables(4).DefaultView)

xls.SetDataSource("ERBPros", ds.Tables(5).DefaultView)

Dim markers As String() = xls.GetSmartMarkers()

xls.Process(True)

xls.Save("Enduring Relationship Detail Report.xls", Aspose.Cells.SaveType.OpenInExcel, Aspose.Cells.FileFormatType.Excel97, Response)

1. To remove unrecognized smart markers, please change your code to:

xls.Process(False)

or

xls.Process()

2. Could you post your designer file(Enduring Relationship Detail Report layout.xls) and output file(Enduring Relationship Detail Report.xls) here? Then I can see if there are some problems in defining those smart markers.