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


C# Worksheet.GetWorksheetProperties方法代码示例

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


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

示例1: Delete

        private void Delete(int? sheetNumber = null, string sheetName = null)
        {
            CheckFiles();

            PrepareArchive(false);

            // Get worksheet details
            Worksheet worksheet = new Worksheet();
            worksheet.GetWorksheetProperties(this, sheetNumber, sheetName);

            // Delete the file
            if (!string.IsNullOrEmpty(worksheet.FileName))
            {
                ZipArchiveEntry entry = this.Archive.GetEntry(worksheet.FileName);
                if (entry != null)
                {
                    entry.Delete();
                }

                if (this.DeleteWorksheets == null)
                {
                    this.DeleteWorksheets = new List<int>();
                }
                this.DeleteWorksheets.Add(worksheet.Index);
            }
        }
开发者ID:Corillian,项目名称:FastExcel,代码行数:26,代码来源:FastExcel.Delete.cs

示例2: Read

        private Worksheet Read(int? sheetNumber = null, string sheetName = null, int existingHeadingRows = 0)
        {
            CheckFiles();
            PrepareArchive();

            Worksheet worksheet = new Worksheet();
            worksheet.ExistingHeadingRows = existingHeadingRows;
            worksheet.GetWorksheetProperties(this, sheetNumber, sheetName);

            IEnumerable<Row> rows = null;

            List<string> headings = new List<string>();
            using (Stream stream = this.Archive.GetEntry(worksheet.FileName).Open())
            {
                XDocument document = XDocument.Load(stream);
                int skipRows = 0;

                Row possibleHeadingRow = new Row(document.Descendants().Where(d => d.Name.LocalName == "row").FirstOrDefault(), this.SharedStrings);
                if (worksheet.ExistingHeadingRows == 1 && possibleHeadingRow.RowNumber == 1)
                {
                    foreach (Cell headerCell in possibleHeadingRow.Cells)
                    {
                        headings.Add(headerCell.Value.ToString());
                    }
                }
                rows = GetRows(document.Descendants().Where(d => d.Name.LocalName == "row").Skip(skipRows));
            }

            worksheet.Headings = headings;
            worksheet.Rows = rows;

            return worksheet;
        }
开发者ID:Corillian,项目名称:FastExcel,代码行数:33,代码来源:FastExcel.Read.cs


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