本文整理匯總了C#中NPOI.XSSF.UserModel.XSSFWorkbook.SetPrintArea方法的典型用法代碼示例。如果您正苦於以下問題:C# XSSFWorkbook.SetPrintArea方法的具體用法?C# XSSFWorkbook.SetPrintArea怎麽用?C# XSSFWorkbook.SetPrintArea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NPOI.XSSF.UserModel.XSSFWorkbook
的用法示例。
在下文中一共展示了XSSFWorkbook.SetPrintArea方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static void Main(string[] args)
{
IWorkbook wb = new XSSFWorkbook();
ISheet sheet1 = wb.CreateSheet("new sheet");
ISheet sheet2 = wb.CreateSheet("second sheet");
// Set the columns to repeat from column 0 to 2 on the first sheet
IRow row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue(1);
row1.CreateCell(1).SetCellValue(2);
row1.CreateCell(2).SetCellValue(3);
IRow row2 = sheet1.CreateRow(1);
row2.CreateCell(1).SetCellValue(4);
row2.CreateCell(2).SetCellValue(5);
IRow row3 = sheet2.CreateRow(1);
row3.CreateCell(0).SetCellValue(2.1);
row3.CreateCell(4).SetCellValue(2.2);
row3.CreateCell(5).SetCellValue(2.3);
IRow row4 = sheet2.CreateRow(2);
row4.CreateCell(4).SetCellValue(2.4);
row4.CreateCell(5).SetCellValue(2.5);
// Set the columns to repeat from column 0 to 2 on the first sheet
wb.SetRepeatingRowsAndColumns(0, 0, 2, -1, -1);
// Set the the repeating rows and columns on the second sheet.
wb.SetRepeatingRowsAndColumns(1, 4, 5, 1, 2);
//set the print area for the first sheet
wb.SetPrintArea(0, 1, 2, 0, 3);
FileStream sw = File.Create("test.xlsx");
wb.Write(sw);
sw.Close();
}