EPPLus语法是EPPLus对象using (excelpackagepackage=newexcelpackage ) new fileinfo (@ ‘ d : (sample.xlsx ‘ ) ) /

初始化sheet (excelworksheetsheet=package.workbook.worksheets.add (sheet name ) ); zxdls赋值sheet.cells [ 1,1 ].value=’ id ‘; sheet.cells [ 1,2 ].value=’ product ‘; sheet.Cells[‘A4’].Value=’Price ‘; 合并zxdls //会合并介于a,b和a,b之间的zxdls。 sheet.Cells[int A,int b,int a,int B].Merge=True; 某zxdlsvarcell=sheet.cells [ 1,1 ]; 字体样式//字体名称sheet.cells [ 2,1,2,10 ].style.font.name=’宋体’; //字体粗体sheet.cells [ 2,1,2,10 ].style.font.bold=true; //字体大小sheet.cells [ 1,1 ].style.font.size=1; zxdls对齐//水平对齐sheet.cells [ 1,1,a,b ].style.horizontal alignment=excelhorizontalalignment.center; //worksheet.cells.style.vertical alignment=excelverticalalignment.bottom; 整个表单的颜色worksheet.cells.style.fill.pattern type=excelfillstyle.solid; worksheet.cells.style.fill.background color.setcolor (color.light blue; 自动换行sheet.Cells[a,b].Style.WrapText=true; zxdls值sheet.Cells[a,b,a,b ].style.number format.format=’ 0.00 ‘; zxdls内容颜色sheet.cells [ 1,1 ].style.font.color.setcolor (color.red ); zxdls边框//边框及其颜色sheet.cells [ 1,1 ].style.border.border around (excel border style.thin,color.fromargb ) ) //WPF是与设备无关的单位(每单位1/96英寸)。 sheet.column(1).Width=column.ActualWidth; //行高sheet.row(b ).Height=12; //zxdls适应宽度高度sheet.cells.style.shrink tofit=true; 设置超链接sheet.cells [ 1,1 ].hyperlink=newexcelhyperlink (http 3360 (www.Baidu.com),UriKind.Relative )。 全局表自适应孝顺的百合sheet.Cells.AutoFitColumns (; sheet.cells [ 1,1 ].autofit columns (;