I am having some difficulties when trying to use arrays with smart markers.
I have a dataset which is made up with a variety of column types including:
However when one of the column type contains an array or System.String[] all that displays in the field is System.String[] instead of the contents.
Smart Marker:
&=Table.[client]
Code:
Aspose.Cells.WorkbookDesigner wd = new Aspose.Cells.WorkbookDesigner();
Aspose.Cells.License lic = new Aspose.Cells.License();
lic.SetLicense("Aspose.Total.lic");
wd.Workbook = new Aspose.Cells.Workbook(rep.getExcelPath());
wd.SetDataSource(rep.getDataSet(lst));
wd.Process(true);
wd.Workbook.Save(this.Response, "Report.xlsx", Aspose.Cells.ContentDisposition.Attachment, new Aspose.Cells.OoxmlSaveOptions());
I was wondering if there is anyway to automatically display the contents without modifying the data?
Hi,
Please create a sample console application, zip it and post it to show the issue on our end. Also, provide us the template and output files. Please use hard coded values for your data source, variables, objects etc. We will check your issue and logged it if we found the issue.
Thank you.
Please see attached ZIP file
The issue is occurring on the client column of the table.
I have used a hard coded dataset however when I am retrieving the information from the database I am reading it to a dataset
Hi,
Well, it will not work with String[]. Even if I try to use the following code
(without involving Aspose.Cells APIs) to get the second field’s (client field) first record, it also gives me System.String[]. See the sample code:
DataTable dt = new DataTable(“Table”);
dt.Columns.Add(new DataColumn(“title”));
dt.Columns.Add(new DataColumn(“client”));
DataRow drow = dt.NewRow();
drow[0] = “item 1”;
drow[1] = new string[] { “Client 1”, “client 2” };
dt.Rows.Add(drow);
drow = dt.NewRow();
drow[0] = “item 2”;
drow[1] = new string[] { “ABC Client 1”, “XYZ client 2” };
dt.Rows.Add(drow);
ds.Tables.Add(dt);
MessageBox.Show(dt.Rows[0][1].ToString()); // --> it also gives me System.String[].
You should use:
//…
DataRow drow = dt.NewRow();
drow[0] = “item 1”;
drow[1] = “Client 1, Client 2”;
dt.Rows.Add(drow);
drow = dt.NewRow();
drow[0] = “item 2”;
drow[1] = “ABC Client 1, XYZ client 2”;
It will work fine.
Thank you.