I have a spreadshhet I just created, I get a WorksheetRegion and use the FormatAsTable method. I now have a table that uses the default Excel style. I want to be able to have no style on this table. This would be the equivalent of using the COM command below
ActiveSheet.ListObjects("Table1").TableStyle = ""
Nothing I've tried removes the style or allows me to add a table with no style. I can change the style fine, removing is the problem.
Any ideas?
Thanks,
Tom
Hello Tom,
The tooltip shown is pulled from the string you assigned for your WorkSheetTableStyle. Since excel demands a name you can set the tableStyle.Name property to open quotes " " if you don't want text shown in the tooltip.
When using Excel (2013 in my case), when you have a table, and the cursor is in one of the table cells, there's a "Design" tab on the Ribbon. If you click on the design tab, you'll have a "Table Styles" section on the ribbon. This sections shows a few styles, the exact number depends upon the size of your window. If you choose the drop down button, a panel opens showing a large number of styles. They are divided into Light, Medium, and Dark. Each of the Table style images has a tooltip with the name of the style. In the upper left is a "Style" with the tooltip value of "None".
I am glad my recommendation worked for you, but can you please clarify what you mean by the selelctor and labels?
If you have any additional quesitons please do not hestate to ask.
Hi,
This works and is almost exactly the same as having no style. The only difference to anyone using the spreadsheet is the style selector shows both this style, and the one that it labels "None".
You can create your own custom style and add it to the workbook's CustomTableStyles collection. This way when you pass your custom style as the second parameter for FormatAsTable and the default style won't be used. The cells will appear as normal but with an empty custom style applied. You can always modifiy your table later or we also have 60 standard styles from which you can choose from as well.
Here is an example of exporting the grid to excel, but beforehand I override the worksheet and define my new custom region and table.
void ultraGridExcelExporter1_ExportStarted(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportStartedEventArgs e) { Infragistics.Documents.Excel.WorksheetRegion region = new Infragistics.Documents.Excel.WorksheetRegion(e.CurrentWorksheet, 0, 0, 5, 0); WorksheetTableStyle tableStyle = new WorksheetTableStyle("customTableStyle"); e.Workbook.CustomTableStyles.Add(tableStyle); var customStyle = e.Workbook.CustomTableStyles[0]; Infragistics.Documents.Excel.WorksheetTable table = region.FormatAsTable(true, customStyle);
}
I recommend submitting a feature request on our website <ideas.infragistics.com> so that the leaving the second parameter for FormatTableString empty will not use the default style.
Let me know if you have any quesitons regarding this matter.