ExcelFile.MarkColForAutofit Method
Overloads
- ExcelFile.MarkColForAutofit(Int32, Boolean, Double)
- ExcelFile.MarkColForAutofit(Int32, Boolean, Double, Int32, Int32, Int32, Boolean)
ExcelFile.MarkColForAutofit(Int32, Boolean, Double)
Marks a column as candidate for future autofit. Note that this method will NOT change anything on the file. It just "marks" the column so you can use it later with AutofitMarkedRowsAndCols(Boolean, Boolean, Double).
Remarks
You can use this method for "delay-marking" columns that you will want to autofit later, but that you cannot autofit yet since they are not filled with data.There is normally no need to use this method, but it is used on report generation to "mark" <#col width(autofit)> tags so those rows and columns can be autofitted once the data on the sheet has been filled.
Syntax
Namespace: FlexCel.Core
public void MarkColForAutofit(Int32 col, Boolean autofit, Double adjustment)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
col | Int32 | Column index (1 based) | |
autofit | Boolean | Set this to true to mark the column for autofitting, false for removing the column from autofitting list. | |
adjustment | Double | You will normally want to set this parameter to 1, which means that autofit will be made with standard measurements. If you set it to for example 1.1, then columns will be adjusted to 110% percent of what their calculated width was. Use this parameter to fine-tune autofiting, if for example columns are too small when opening the file in Excel. |
See also
ExcelFile.MarkColForAutofit(Int32, Boolean, Double, Int32, Int32, Int32, Boolean)
Marks a column as candidate for future autofit. Note that this method will NOT change anything on the file. It just "marks" the column so you can use it later with AutofitMarkedRowsAndCols(Boolean, Boolean, Double).
Remarks
You can use this method for "delay-marking" columns that you will want to autofit later, but that you cannot autofit yet since they are not filled with data.There is normally no need to use this method, but it is used on report generation to "mark" <#col width(autofit)> tags so those rows and columns can be autofitted once the data on the sheet has been filled.
Syntax
Namespace: FlexCel.Core
public abstract void MarkColForAutofit(Int32 col, Boolean autofit, Double adjustment, Int32 adjustmentFixed, Int32 minWidth, Int32 maxWidth, Boolean isMerged)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
col | Int32 | Column index (1 based) | |
autofit | Boolean | Set this to true to mark the column for autofitting, false for removing the column from autofitting list. | |
adjustment | Double | You will normally want to set this parameter to 1, which means that autofit will be made with standard measurements. If you set it to for example 1.1, then columns will be adjusted to 110% percent of what their calculated width was. Use this parameter to fine-tune autofiting, if for example columns are too small when opening the file in Excel. |
|
adjustmentFixed | Int32 | You will normally set this parameter to 0, which means standard autofit. If you set it to a value, the row will be made larger by that amount from the calculated autofit. Different from the "adjustment" parameter, this parameter adds a fixed size to the column and not a percentage. The final size of the column will be: FinalSize = CalulatedAutoFit * adjustment + adjusmentFixed | |
minWidth | Int32 | Minimum final width for the column to autofit. If the calculated value is less than minWidth, column size will be set to minWidth. A negative value on minWidth means the column size will be no smaller than the original width. |
|
maxWidth | Int32 | Maximum final width for the column to autofit. If the calculated value is more than maxWidth, column size will be set to maxWidth. maxWidth = 0 means no maxWidth. A negative value on maxWidth means the column size will be no bigger than the original width. |
|
isMerged | Boolean | If true, only the cell will be autofitted, not the whole column. |