Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Wed Nov 26, 2014 10:29 pm

Is there anyway filters (So shows the drop down optiond against the title row) to be applied to the title row of exported data or so the data can be formatted as a table

ascotford
 
Posts: 12
Joined: Wed Sep 18, 2013 3:34 pm

Thu Nov 27, 2014 6:02 am

Dear ascotford,

Thanks for your inquiry.

For your requirement, please refer to the code below:
Code: Select all
public void TableData()
{
    Workbook book = new Workbook();
    Worksheet sheet = book.Worksheets[0];
    DataTable dt = GetData();
    sheet.InsertDataTable(dt, true, 1, 1);
    sheet.ListObjects.Create("Table", sheet.Range[1, 1, dt.Rows.Count + 1, dt.Columns.Count]);
    sheet.ListObjects[0].BuiltInTableStyle = TableBuiltInStyles.TableStyleLight9;
    //sheet.ListObjects[0].DisplayTotalRow = true;
    book.SaveToFile(@"..\..\TableData.xlsx", ExcelVersion.Version2010);
    System.Diagnostics.Process.Start(@"..\..\TableData.xlsx");

}
private DataTable GetData()
{
    DataTable dt = new DataTable();
    dt.Columns.Add("Year", typeof(int));
    dt.Columns.Add("Name", typeof(string));
    dt.Columns.Add("Brand", typeof(string));
    dt.Columns.Add("Qty", typeof(int));
    dt.Rows.Add(2011, "Processor", "Intel", 5);
    dt.Rows.Add(2012, "RAM", "Corsair", 30);
    dt.Rows.Add(2013, "HDD", "Segate", 20);
    return dt;
}

Best Regards,
Burning
E-iceblue Support Team
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Mon Dec 01, 2014 8:42 am

Dear ascotford,

Have you tried the method I provided to resolve your problem? Did it work?

Please give us some feedback if convenience.

Best Regards,
Burning
E-iceblue Support Team
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Fri Dec 19, 2014 3:59 pm

Is this code not for your Spire.xls control where as I have posted this in your Spire.DataExport forum as I only have this control?

ascotford
 
Posts: 12
Joined: Wed Sep 18, 2013 3:34 pm

Mon Dec 22, 2014 3:45 am

Dear ascotford,

Sorry for the delay reply.

Exactly, the sample code I provided is for Spire.XLS, not for Spire.DataExport. Sorry that currently Spire.DataExport doesn't support the feature you mentioned.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.DataExport