本文整理汇总了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);
}
}
示例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;
}