• EPPlus导入导出不占用进程


    导入:

    1 using (ExcelPackage package = new ExcelPackage(new FileStream(openFile.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
    2 {
    3     ExcelWorksheet sheet = package.Workbook.Worksheets[1];
    4     object title = sheet.Cells[3, 1].Value ?? "";
    5     // do
    6     int row = 4;
    7 }

    导出

     1 using (var package = new ExcelPackage(new FileInfo(sfd.FileName)))
     2 {
     3     var sheet = package.Workbook.Worksheets.Add("Abc");
     4     int rowIndex = 1;
     5     sheet.Cells[rowIndex, 1].Value = "日期";
     6     sheet.Cells.AutoFitColumns();
     7     sheet.Cells[1, 1, rowIndex, 12].Style.Border.Left.Style = ExcelBorderStyle.Thin;
     8     sheet.Cells[1, 1, rowIndex, 12].Style.Border.Top.Style = ExcelBorderStyle.Thin;
     9     sheet.Cells[1, 1, rowIndex, 12].Style.Border.Right.Style = ExcelBorderStyle.Thin;
    10     sheet.Cells[1, 1, rowIndex, 12].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
    11     package.Save();
    12     package.Dispose();
    13 }
  • 相关阅读:
    Section 3.1 Shaping Regions
    3D@OpenSource
    查找资料
    Section 3.1 Shaping Regions Again
    USACO Contact IOI’98 TLE
    事项ON丰宁坝上草原
    四叉树@POJ1610 Quad Trees
    在TabCtrl上放View@MFC
    CUGB的一场周赛
    贴图程序进展
  • 原文地址:https://www.cnblogs.com/jonney-wang/p/8796862.html
Copyright © 2020-2023  润新知