本文整理汇总了C#中Worksheet.AutoFitColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.AutoFitColumn方法的具体用法?C# Worksheet.AutoFitColumn怎么用?C# Worksheet.AutoFitColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worksheet
的用法示例。
在下文中一共展示了Worksheet.AutoFitColumn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoTest
//The custom DoTest method
public void DoTest()
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
//Instantiate a workbook object
Workbook book = new Workbook();
//Create a worksheet object and get the first worksheet
Worksheet sheet1 = book.Worksheets[0];
//Set the first worksheet to _sheet object
_sheet = sheet1;
//Call different custom methods
//These methods exhibits different conditional formatting types with their custom
//formattings attributes for MS Excel 2007 .xlsx file format
AddDefaultIconSet();
AddIconSet2();
AddIconSet3();
AddIconSet4();
AddIconSet5();
AddIconSet6();
AddIconSet7();
AddIconSet8();
AddIconSet9();
AddIconSet10();
AddIconSet11();
AddIconSet12();
AddIconSet13();
AddIconSet14();
AddIconSet15();
AddIconSet16();
AddIconSet17();
AddIconSet18();
AddDefaultColorScale();
Add3ColorScale();
Add2ColorScale();
AddAboveAverage();
AddAboveAverage2();
AddAboveAverage3();
AddTop10_1();
AddTop10_2();
AddTop10_3();
AddTop10_4();
AddDataBar1();
AddDataBar2();
AddContainsText();
AddNotContainsText();
AddContainsBlank();
AddNotContainsBlank();
AddBeginWith();
AddEndWith();
AddContainsError();
AddNotContainsError();
AddDuplicate();
AddUnique();
AddTimePeriod_1();
AddTimePeriod_2();
AddTimePeriod_3();
AddTimePeriod_4();
AddTimePeriod_5();
AddTimePeriod_6();
AddTimePeriod_7();
AddTimePeriod_8();
AddTimePeriod_9();
AddTimePeriod_10();
//AutoFit M Column in the worksheet
_sheet.AutoFitColumn(12);
//Specify the output file path
string outfn = dataDir+ "Testoutput.xlsx";
//Save the excel file
book.Save(outfn, SaveFormat.Xlsx);
}