XLS - Table Formatting / Title Filter

Technical support for Spire.DataExport

Moderators: iceblue support, DataExport, Manager

XLS - Table Formatting / Title Filter

Postby ascotford » 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

Re: XLS - Table Formatting / Title Filter

Postby burning.liu » 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: 410
Joined: Mon Aug 04, 2014 6:47 am

Re: XLS - Table Formatting / Title Filter

Postby burning.liu » 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: 410
Joined: Mon Aug 04, 2014 6:47 am

Re: XLS - Table Formatting / Title Filter

Postby ascotford » 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

Re: XLS - Table Formatting / Title Filter

Postby burning.liu » 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: 410
Joined: Mon Aug 04, 2014 6:47 am


Return to Spire.DataExport

Who is online

Users browsing this forum: No registered users and 0 guests