Adding Design Page and SmartMarker Option


#1

Hello
I am trying to add Excel Desiner to may project
I have added the &=DataSource.FieldName to mutiple firstrow cells

When i save the page to my desktop I am not getting the FieldName The cells show &=DataSource.FieldName.

I am using the following C# code

private void Button1_Click(object sender, System.EventArgs e)
{
Excel excel = new Excel();
ExcelDesigner designer = new ExcelDesigner();
excel.Open(“c:\design.xls”);
excel.Worksheets[0].Cells.ImportDataGrid(dgMain, 1, 1, true);
//AutoFit the first row
excel.Worksheets[0].AutoFitRow(0);
//AutoFit the first column
excel.Worksheets[0].AutoFitColumn(0);
excel.Save(“result.xls”, SaveType.OpenInExcel, FileFormatType.Default, this.Response);

}

What am i doing wrong???

Thanks for the assistance


#2

If you want to polulate data to your smart markers, you should do by this:

ExcelDesigner designer = new ExcelDesigner();
designer.Open(“c:\design.xls”);
designer.SetDataSource(dataSet); //This dataset should contains a Table which name is same as “DataSource” and a column’s name is “FieldName”. Please refer to the sample code of our online smartmarker demo

designer.Process();

designer.Save(“result.xls”, SaveType.OpenInExcel, FileFormatType.Default, this.Response);


#3

Hi Laurance,

I changed my code to the lowwoing but I still am not ablt to get the Column title to work.

{

ExcelDesigner designer = new ExcelDesigner();

designer.Open(“c:\design.xls”);
designer.Excel.Worksheets[0].Cells.ImportDataGrid(dgMain, 0, 1,true);

//AutoFit the first row
designer.Excel.Worksheets[0].AutoFitRow(0);

//AutoFit the first column
designer.Excel.Worksheets[0].AutoFitColumn(0);

designer.Process();

designer.Save(“result.xls”, SaveType.OpenInExcel, FileFormatType.Default, this.Response);

}


#4

Hi,

ImportDataGrid method doesn’t import the column title of the datagrid because I don’t find the way to get it.


#5

Thanls,

So how do i get the header information?


#6

Since you create the DataGrid in your web page, I think you can get the header information with your code and put the data to a spreadsheet using Aspose.Excel.