Free Support Forum - aspose.com

Smart Marker Not Working

Hi,

I’m trying to get smart markers to work. I can get some success if I use a variable, but I get nothing when using a datatable or dataset as a datasource.

Here is my code:

protected void Button1_Click(object sender, EventArgs e)
{
try
{
DataTable dt_doc = new DataTable();
dt_doc = GetDocument(20);

DataSet ds = new DataSet();
ds.Tables.Add(dt_doc);


foreach (DataColumn col in ds.Tables[0].Columns)
{
ListBox1.Items.Add(col.ColumnName);
}

string path = “C:\Template.xlsx”;

WorkbookDesigner designer = new WorkbookDesigner();
designer.Workbook = new Workbook(path);

designer.SetDataSource(ds);

designer.SetDataSource(“test”, “test111”);

designer.Process();

designer.Workbook.Save(“C:\test.xlsx”);
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}

I’ve also attached the template excel file.

It all look right to me, but cell A1 is the saved version is always blank ??

The datatable returns a single row of data.

Hi,

Thanks for your posting and using Aspose.Cells for NET.

Please study the following article. It will help you understand smart marker features better and you will be able to modify the existing code as per your needs.