Is there a setting somewhere that will auto format the width of a column? I am exporting out a ton of grids and I would really like to think that I would not have to set each column's width manually.
But can we have any event of the Excel Export API so that we can set the width there such as ,
$.ig.GridExcelExporter.exportGrid($("#TreeGrid"),{ fileName: "XYZ", worksheetName: XYZ Report', // columnsToSkip: ["ProductID", "Supplier"] });
here any event through which we can set the width, and formatting of the Columns in the Exported File
As also Iam facing one more problem in the exported File
Hello Ryan,
I am just following up to check if you have any additional questions. If so, don't hesitate to contact me again.
Thank you for your update!
The default igGrid table “table-layout” is set to “fixed”. You might test your case by setting the table layout to “auto”. It is needed to add the following style:
<style>
#grid1
{
table-layout: auto!important;
}
</style>
One more setting that could be useful to change is setting the ‘fixedHeader’ option to false:
$(".selector").igGrid({
fixedHeaders : false
});
You might be also interested in reading through the following forum thread:
https://ko.infragistics.com/community/forums/f/ignite-ui-for-javascript/74176/iggrid-column-auto-width
If you have any further questions or concerns feel free to contact me again. I will need an isolated sample to investigate further.
Ah, thanks for that bit of information. We are not using the width setting on the igGrids as we are sizing them via the div container so when they are exporting to excel via the Excel library control, they get exported with no width settings. I know we can set the setting via the export method in the sample code below.
curreWorksheet.Columns[0].CellFormat.Alignment = HorizontalCellAlignment.Center; curreWorksheet.Columns[0].Width = 1000;
I was just hoping there was a quick way to set each column to an "auto width" but I guess there isn't. HA! Thanks.
Thank you for posting in our community!
The igGrid has default value for the column widths. It is calculated as the whole grid width is divided by the number of the columns. These default values could be changed when the grid is initialized. I have added a code snippet which demonstrates how custom widths could be set for your reference:
$("#grid1").igGrid({
primaryKey: "ProductID",
autoCommit: true,
columns: [
{ headerText: "Product ID", key: "ProductID", dataType: "number", width: "30px" },
{ headerText: "Product Name", key: "Name", dataType: "string", width: "120px" },
{ headerText: "Product Number", key: "ProductNumber", dataType: "string", width: "100px" },
],
When exporting is used it is expected the column widths values to be maintained.
If you need more details could you please provide me additional information for your scenario? What are the grids exported to? Have you set default values for the column widths when the grids are initialized?
Looking forwards to hearing from you.