当前位置: 首页>>代码示例>>C#>>正文


C# Workbook.Dispose方法代码示例

本文整理汇总了C#中Workbook.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Workbook.Dispose方法的具体用法?C# Workbook.Dispose怎么用?C# Workbook.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Workbook的用法示例。


在下文中一共展示了Workbook.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public static void Run()
        {
            // ExStart:ReleaseUnmanagedResourcesForWorkbooks
            // Create workbook object
            Workbook wb1 = new Workbook();

            // Call Dispose method
            wb1.Dispose();

            // Call Dispose method via Using statement
            using (Workbook wb2 = new Workbook())
            {
                // Any other code goes here
            }
            // ExEnd:ReleaseUnmanagedResourcesForWorkbooks
        }
开发者ID:aspose-cells,项目名称:Aspose.Cells-for-.NET,代码行数:16,代码来源:ReleaseUnmanagedResources.cs

示例2: AddRow

        public void AddRow(CheckPointLogModel logData)
        {
            var columns = new List<KeyValuePair<string, object>>();

            if (logData != null)
            {
                columns.Add(new KeyValuePair<string, object>("№", logData.Counters.Journal));
                columns.Add(new KeyValuePair<string, object>("Дата", this.TruncateDate(logData.StartDate).ToString(StringConstrants.DateTimeFormat)));
                columns.Add(new KeyValuePair<string, object>("Changelist", logData.Counters.MaxCommitChange));
                columns.Add(new KeyValuePair<string, object>("Upgrade", logData.Counters.Upgrade));
                columns.Add(new KeyValuePair<string, object>("Потребители", logData.UserCount));
                columns.Add(new KeyValuePair<string, object>("Проекти", logData.ProjectCount));
                columns.Add(new KeyValuePair<string, object>("Файлове", logData.Sizes.FilesCount));
                columns.Add(new KeyValuePair<string, object>("Версии", logData.Sizes.RevisionsCount));
                columns.Add(new KeyValuePair<string, object>("Депо", string.Format("{0:0.00} Mb", logData.DepotSize)));
                columns.Add(new KeyValuePair<string, object>("Log", string.Format("{0:0.00} Mb", logData.Log.FileSize)));
                columns.Add(new KeyValuePair<string, object>("Auditlog", string.Format("{0:0.00} Mb", logData.AuditLog.FileSize)));
                columns.Add(new KeyValuePair<string, object>("Име", logData.Arhive != null ? logData.Arhive.ArhivePatternName : string.Empty));
                columns.Add(new KeyValuePair<string, object>("Размер", string.Format("{0:0.00} Mb", logData.Arhive != null ? logData.Arhive.Size : 0)));
                columns.Add(new KeyValuePair<string, object>("Платформа", logData.ServerInfo.Platform));
                columns.Add(new KeyValuePair<string, object>("Версия", string.Format("'{0}", logData.ServerInfo.Version)));
                columns.Add(new KeyValuePair<string, object>("Ревизия", logData.ServerInfo.Revision));
                columns.Add(new KeyValuePair<string, object>("от Дата", this.TruncateDate(logData.ServerInfo.Date).ToString(StringConstrants.DateFormat)));
            }

            var workbook = new Workbook();
            workbook.LoadFromFile(this.FullFileRoot);
            Worksheet sheet = workbook.Worksheets.FirstOrDefault(s => s.Name == SheetName) as Worksheet;
            if (sheet == null)
            {
                throw new ArgumentNullException("Excel sheet not found");
            }

            var range = sheet.Range;
            var headerStart = this.FindHeader(range, "№");
            var lastRow = this.FindLastRow(range, headerStart);
            sheet.InsertRow(lastRow.Row, 1, InsertOptionsType.FormatAsBefore);

            for (int index = 0; index < columns.Count; index++)
            {
                var currentCol = lastRow.Column + index;
                var headerText = sheet.Range[headerStart.Row, currentCol].Text;
                var currentCell = columns[index];
                if (headerText == currentCell.Key)
                {
                    sheet.Range[lastRow.Row, currentCol].Value2 = currentCell.Value;
                }
            }

            workbook.Save();
            workbook.Dispose();
        }
开发者ID:StefanMihaylov,项目名称:PerforceBackup,代码行数:52,代码来源:ExcelWriter.cs


注:本文中的Workbook.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。