本文整理汇总了C#中IXLWorksheet类的典型用法代码示例。如果您正苦于以下问题:C# IXLWorksheet类的具体用法?C# IXLWorksheet怎么用?C# IXLWorksheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IXLWorksheet类属于命名空间,在下文中一共展示了IXLWorksheet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MakeHeaders
private void MakeHeaders(IXLWorksheet sheet, TestSuite suite)
{
int column = 1;
for (; column <= deep; column++)
{
string header = string.Empty;
for (int i = 1; i < column; i++)
header += "Sub-";
sheet.Cell(row, column).Value = header + "Category";
sheet.Column(column).Width = 20.86;
}
sheet.Cell(row, deep + 1).Value = "Name";
sheet.Column(deep + 1).Width = 30;
sheet.Cell(row, deep + 2).Value = "Id";
sheet.Column(deep + 2).Width = 13;
sheet.Cell(row, deep + 3).Value = "Summary";
sheet.Column(deep + 3).Width = 42;
sheet.Cell(row, deep + 4).Value = "Preconditions";
sheet.Column(deep + 4).Width = 56.43;
sheet.Cell(row, deep + 5).Value = "Actions";
sheet.Column(deep + 5).Width = 100;
sheet.Cell(row, deep + 6).Value = "Expected Results";
sheet.Column(deep + 6).Width = 100;
row++;
}
开发者ID:jnykiel,项目名称:TestLink2Excel,代码行数:29,代码来源:ExcelWriter.cs
示例2: ProcessWorksheet
private void ProcessWorksheet(IXLWorksheet xlWorksheet)
{
if (!_uniqueIdMapping.Any())
_uniqueIdMapping =
_pcfService.GetForChurch(this._churchId)
.Select(i => new { i.UniqueId, i.Id })
.ToDictionary(t => t.UniqueId, t => t.Id);
var rows = xlWorksheet.RowsUsed();
foreach (var row in rows)
{
var pcfUniqueId = row.FirstCellUsed().GetString();
var pcfId =
_uniqueIdMapping.FirstOrDefault(
i => i.Key.Equals(pcfUniqueId, StringComparison.InvariantCultureIgnoreCase)).Value;
if (pcfId != 0)
{
var m = new StagedCells()
{
Name = row.FirstCellUsed().CellRight().GetString(),
UniqueId = UniqueIdGenerator.GenerateUniqueIdForCell(name: row.FirstCellUsed().GetString()),
PCFId = pcfId,
ChurchId = this._churchId
};
_cellService.Insert(m);
}
}
}
开发者ID:edikep2000,项目名称:Zakar,代码行数:28,代码来源:CellExcelFileHandler.cs
示例3: ExcelParser
/// <summary>
/// Creates a new parser using the given <see cref="IXLWorksheet"/> and <see cref="CsvConfiguration"/>.
/// </summary>
/// <param name="worksheet">The <see cref="IXLWorksheet"/> with the data.</param>
/// <param name="configuration">The configuration.</param>
public ExcelParser(IXLWorksheet worksheet, CsvConfiguration configuration)
{
workbook = worksheet.Workbook;
this.worksheet = worksheet;
this.configuration = configuration;
FieldCount = worksheet.RowsUsed().CellsUsed().Max(cell => cell.Address.ColumnNumber);
}
开发者ID:DustinH,项目名称:CsvHelper.Excel,代码行数:12,代码来源:ExcelParser.cs
示例4: Format
public void Format(IXLWorksheet worksheet, Feature feature)
{
worksheet.Cell("A1").Style.Font.SetBold();
worksheet.Cell("A1").Value = feature.Name;
worksheet.Cell("B2").Value = feature.Description;
worksheet.Cell("B2").Style.Alignment.WrapText = false;
var results = testResults.GetFeatureResult(feature);
if (configuration.HasTestResults && results.WasExecuted)
{
worksheet.Cell("A1").Style.Fill.SetBackgroundColor(results.WasSuccessful
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
int row = 4;
foreach (IFeatureElement featureElement in feature.FeatureElements)
{
var scenario = featureElement as Scenario;
if (scenario != null)
{
excelScenarioFormatter.Format(worksheet, scenario, ref row);
}
var scenarioOutline = featureElement as ScenarioOutline;
if (scenarioOutline != null)
{
excelScenarioOutlineFormatter.Format(worksheet, scenarioOutline, ref row);
}
row++;
}
}
开发者ID:ppnrao,项目名称:pickles,代码行数:34,代码来源:ExcelFeatureFormatter.cs
示例5: Format
public void Format(IXLWorksheet worksheet, ScenarioOutline scenarioOutline, ref int row)
{
int originalRow = row;
worksheet.Cell(row++, "B").Value = scenarioOutline.Name;
worksheet.Cell(row++, "C").Value = scenarioOutline.Description;
var results = this.testResults.GetScenarioOutlineResult(scenarioOutline);
if (this.configuration.HasTestResults && (results != TestResult.Inconclusive))
{
worksheet.Cell(originalRow, "B").Style.Fill.SetBackgroundColor(results == TestResult.Passed
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
foreach (Step step in scenarioOutline.Steps)
{
this.excelStepFormatter.Format(worksheet, step, ref row);
}
row++;
foreach (var example in scenarioOutline.Examples)
{
worksheet.Cell(row++, "B").Value = "Examples";
worksheet.Cell(row, "C").Value = example.Description;
this.excelTableFormatter.Format(worksheet, example.TableArgument, ref row);
}
}
开发者ID:MikeThomas64,项目名称:pickles,代码行数:28,代码来源:ExcelScenarioOutlineFormatter.cs
示例6: Format
public void Format(IXLWorksheet worksheet, Table table, ref int row)
{
int startRow = row;
int headerColumn = TableStartColumn;
foreach (string cell in table.HeaderRow)
{
worksheet.Cell(row, headerColumn).Style.Font.SetBold();
worksheet.Cell(row, headerColumn).Style.Font.SetItalic();
worksheet.Cell(row, headerColumn).Style.Fill.SetBackgroundColor(XLColor.AliceBlue);
worksheet.Cell(row, headerColumn++).Value = cell;
}
row++;
foreach (TableRow dataRow in table.DataRows)
{
int dataColumn = TableStartColumn;
foreach (string cell in dataRow)
{
worksheet.Cell(row, dataColumn++).Value = cell;
}
row++;
}
int lastRow = row - 1;
int lastColumn = headerColumn - 1;
worksheet.Range(startRow, TableStartColumn, lastRow, lastColumn).Style.Border.TopBorder =
XLBorderStyleValues.Thin;
worksheet.Range(startRow, TableStartColumn, lastRow, lastColumn).Style.Border.LeftBorder =
XLBorderStyleValues.Thin;
worksheet.Range(startRow, TableStartColumn, lastRow, lastColumn).Style.Border.BottomBorder =
XLBorderStyleValues.Thin;
worksheet.Range(startRow, TableStartColumn, lastRow, lastColumn).Style.Border.RightBorder =
XLBorderStyleValues.Thin;
}
开发者ID:ppnrao,项目名称:pickles,代码行数:35,代码来源:ExcelTableFormatter.cs
示例7: AppendOmnitureStandardPageView
public static void AppendOmnitureStandardPageView(IXLWorksheet omniture)
{
var values = new string[] {
"t-1",
"",
"DUNLOP",
"HOMEPAGE",
"HOMEPAGE",
"INDEX",
"index",
"",
"",
"DUNLOP | HOMEPAGE | HOMEPAGE | INDEX",
"",
"HOMEPAGE",
"HOMEPAGE",
"HOMEPAGE | HOMEPAGE",
"INDEX",
"HOMEPAGE | INDEX",
"HOMEPAGE | HOMEPAGE | INDEX",
"INDEX",
"HOMEPAGE | INDEX",
"HOMEPAGE | INDEX | INDEX",
"HOMEPAGE | HOMEPAGE | HOMEPAGE | INDEX"
};
}
开发者ID:rodrigoi,项目名称:xml-conversion-tool,代码行数:26,代码来源:WorkbookHelper.cs
示例8: getTotalWidth
public static double getTotalWidth(IXLWorksheet ws, int startCol)
{
var totalWidth = 0.0;
foreach (var col in ws.Columns(startCol, ws.LastColumnUsed().ColumnNumber()))
{
totalWidth += col.Width * 5.69;
}
return totalWidth;
}
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:10,代码来源:ExcelFunctions.cs
示例9: Format
public void Format(IXLWorksheet worksheet, string documentString, ref int row)
{
string[] documentStringLines = documentString.Split(new[] {"\n", "\r"},
StringSplitOptions.RemoveEmptyEntries);
foreach (string line in documentStringLines)
{
worksheet.Cell(row++, 4).Value = line;
}
}
开发者ID:Jaykul,项目名称:pickles,代码行数:10,代码来源:ExcelDocumentStringFormatter.cs
示例10: getTotalHeight
public static double getTotalHeight(IXLWorksheet ws, int startRow)
{
var totalHeight = 0.0;
foreach (var row in ws.Rows(startRow, ws.LastRowUsed().RowNumber()))
{
totalHeight += row.Height;
}
return totalHeight;
}
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:11,代码来源:ExcelFunctions.cs
示例11: Format
public void Format(IXLWorksheet worksheet, Feature feature)
{
worksheet.Cell("A1").Style.Font.SetBold();
worksheet.Cell("A1").Value = feature.Name;
if (feature.Description.Length <= short.MaxValue)
{
worksheet.Cell("B2").Value = feature.Description;
}
else
{
var description = feature.Description.Substring(0, short.MaxValue);
Log.Warn("The description of feature {0} was truncated because of cell size limitations in Excel.", feature.Name);
worksheet.Cell("B2").Value = description;
}
worksheet.Cell("B2").Style.Alignment.WrapText = false;
var results = this.testResults.GetFeatureResult(feature);
if (this.configuration.HasTestResults && results != TestResult.Inconclusive)
{
worksheet.Cell("A1").Style.Fill.SetBackgroundColor(results == TestResult.Passed
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
var featureElementsToRender = new List<IFeatureElement>();
if (feature.Background != null)
{
featureElementsToRender.Add(feature.Background);
}
featureElementsToRender.AddRange(feature.FeatureElements);
var row = 4;
foreach (var featureElement in featureElementsToRender)
{
var scenario = featureElement as Scenario;
if (scenario != null)
{
this.excelScenarioFormatter.Format(worksheet, scenario, ref row);
}
var scenarioOutline = featureElement as ScenarioOutline;
if (scenarioOutline != null)
{
this.excelScenarioOutlineFormatter.Format(worksheet, scenarioOutline, ref row);
}
row++;
}
}
开发者ID:picklesdoc,项目名称:pickles,代码行数:53,代码来源:ExcelFeatureFormatter.cs
示例12: CopyRowAsRange
private static void CopyRowAsRange(IXLWorksheet originalSheet, int originalRowNumber, IXLWorksheet destSheet, int destRowNumber)
{
{
var destinationRow = destSheet.Row(destRowNumber);
destinationRow.Clear();
var originalRow = originalSheet.Row(originalRowNumber);
int columnNumber = originalRow.LastCellUsed(true).Address.ColumnNumber;
var originalRange = originalSheet.Range(originalRowNumber, 1, originalRowNumber, columnNumber);
var destRange = destSheet.Range(destRowNumber, 1, destRowNumber, columnNumber);
originalRange.CopyTo(destRange);
}
}
开发者ID:hal1932,项目名称:ClosedXML,代码行数:14,代码来源:CopyingRowsAndColumns.cs
示例13: AutoFitWorksheet
public static void AutoFitWorksheet(IXLWorksheet ws, int startCol, int startRow, double lineHeight)
{
foreach (var row in ws.RowsUsed().Skip(startRow))
{
var maxLines = 1.0;
foreach (var cell in row.CellsUsed().Skip(startCol))
{
if (cell.Value != null)
{
var lines = cell.Value.ToString().Length / (cell.WorksheetColumn().Width * 1.15);
maxLines = maxLines < lines ? lines : maxLines;
}
}
row.Height = lineHeight * Math.Ceiling(maxLines);
}
}
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:16,代码来源:ExcelFunctions.cs
示例14: BuildTableOfContents
public void BuildTableOfContents(XLWorkbook workbook, IXLWorksheet worksheet, ref int row, int column, GeneralTree<INode> features)
{
foreach (var childNode in features.ChildNodes)
{
var featureChildNode = childNode.Data as FeatureNode;
if (featureChildNode != null)
{
var featureWorksheet = FindFirstMatchingA1TitleUsingFeatureName(workbook, featureChildNode);
this.WriteFileCell(worksheet, ref row, column, featureWorksheet);
}
else if (childNode.Data.NodeType == NodeType.Structure)
{
this.WriteDirectoryCell(worksheet, ref row, column, childNode.Data.Name);
this.BuildTableOfContents(workbook, worksheet, ref row, column + 1, childNode);
}
}
}
开发者ID:MikeThomas64,项目名称:pickles,代码行数:17,代码来源:ExcelTableOfContentsFormatter.cs
示例15: Format
public void Format(IXLWorksheet worksheet, Step step, ref int row)
{
worksheet.Cell(row, "C").Style.Font.SetBold();
worksheet.Cell(row, "C").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right);
worksheet.Cell(row, "C").Value = step.NativeKeyword;
worksheet.Cell(row++, "D").Value = step.Name;
if (step.TableArgument != null)
{
this.excelTableFormatter.Format(worksheet, step.TableArgument, ref row);
}
if (!string.IsNullOrEmpty(step.DocStringArgument))
{
this.excelDocumentStringFormatter.Format(worksheet, step.DocStringArgument, ref row);
}
}
开发者ID:Jaykul,项目名称:pickles,代码行数:17,代码来源:ExcelStepFormatter.cs
示例16: ProcessWorkSheet
private void ProcessWorkSheet(IXLWorksheet worksheet)
{
if (worksheet != null)
{
foreach (var row in worksheet.RowsUsed())
{
if (row != null && row.RowBelow() != null)
{
var currentRow = row.RowBelow();
if (currentRow != null && currentRow.CellsUsed().Any())
{
var partnerUniqueId = currentRow.FirstCellUsed().GetString();
var armShort = currentRow.FirstCellUsed().CellRight(1).GetString();
var amount = currentRow.FirstCellUsed().CellRight(2).GetDouble();
var currency = currentRow.FirstCellUsed().CellRight(3).GetString();
var month = currentRow.FirstCellUsed().CellRight(4).GetString();
var year = currentRow.FirstCellUsed().CellRight(5).GetString();
var armId = this._partnershipArmMappings.ContainsKey(armShort)
? this._partnershipArmMappings.FirstOrDefault(i => i.Key.Equals(armShort)).Value
: 0;
var currencyId = this._currencySymbol.ContainsKey(currency)
? this._currencySymbol.FirstOrDefault(i => i.Key.Equals(currency)).Value
: 0;
var partnerId = this._partnerIdMappings.ContainsKey(partnerUniqueId)
? this._partnerIdMappings.FirstOrDefault(i => i.Key.Equals(partnerUniqueId)).Value
: 0;
var item = new StagedPartnership()
{
Amount = (decimal) amount,
ArmId = armId,
ChurchId = _churchId,
CurrencyId = currencyId,
DateCreated = DateTime.Now,
Month = 1,
PartnerId = partnerId,
Year = Convert.ToInt32(year)
};
_stagedPartnershipService.Insert(item);
}
}
}
}
}
开发者ID:edikep2000,项目名称:Zakar,代码行数:45,代码来源:PartnershipLogExcelFileHandler.cs
示例17: AppendOmnitureHeaders
public static void AppendOmnitureHeaders(IXLWorksheet omniture)
{
var headers = new string[] {
"Id",
"Parent Id",
"Site",
"Site Section",
"Subsection",
"Active State",
"Object",
"Object Description",
"Call To Action",
"pagename",
"event",
"prop1",
"prop2",
"prop3",
"prop4",
"prop5",
"prop6",
"prop7",
"prop8",
"prop9",
"prop10",
"prop11",
"prop12",
"prop13",
"prop14",
"prop15",
"prop16",
"prop17",
"prop18",
"prop19",
"prop20",
"prop21",
"prop22",
"prop23",
"prop24",
"prop25",
"prop26",
"prop27"
};
AppendArray(omniture, headers);
}
开发者ID:rodrigoi,项目名称:xml-conversion-tool,代码行数:44,代码来源:WorkbookHelper.cs
示例18: ProcessWorksheet
private void ProcessWorksheet(IXLWorksheet workSheet)
{
if (workSheet != null)
{
foreach (var row in workSheet.RowsUsed())
{
if (row != null && row.RowBelow() != null)
{
var currentRow = row.RowBelow();
if (currentRow != null && currentRow.CellsUsed().Any())
{
var title = currentRow.FirstCellUsed().GetString();
var firstName = currentRow.FirstCellUsed().CellRight(1).GetString();
var lastName = currentRow.FirstCellUsed().CellRight(2).GetString();
var email = currentRow.FirstCellUsed().CellRight(3).GetString();
var phone = currentRow.FirstCellUsed().CellRight(4).GetString();
var gender = currentRow.FirstCellUsed().CellRight(5).GetString();
var dateOfBirth = currentRow.FirstCellUsed().CellRight(6).GetDateTime();
var pcfUniqueId = currentRow.FirstCellUsed().CellRight(7).GetString();
var cellUniqueId = currentRow.FirstCellUsed().CellRight(8).GetString();
var pcfId = this._pcfIdMappings.ContainsKey(pcfUniqueId) ? this._pcfIdMappings.FirstOrDefault(i => i.Key.Equals(pcfUniqueId)).Value : 0;
var cellId = this._cellIdMappings.ContainsKey(cellUniqueId) ? this._cellIdMappings.FirstOrDefault(i => i.Key.Equals(cellUniqueId)).Value : 0;
var item = new StagedPartner
{
ChurchId = this._churchId,
DateCreated = DateTime.Now,
Email = email,
Phone = phone,
DateOfBirth = dateOfBirth,
Title = title,
FirstName = firstName,
LastName = lastName,
PCFId = pcfId,
CellId = cellId,
Gender = gender,
UniqueId = IDGenerators.UniqueIdGenerator.GenerateUniqueIdForPartner(firstName + lastName),
};
_stagedPartnerService.Insert(item);
}
}
}
}
}
开发者ID:edikep2000,项目名称:Zakar,代码行数:43,代码来源:PartnerExcelFileHandler.cs
示例19: Estrai_Template_2017
int Estrai_Template_2017(IXLWorksheet wsAnno, int lastRowNumber, IXLWorksheet dati, int riga)
{
var laura = wsAnno.Range("B1", "F" + lastRowNumber).Rows().Select(Movimento.TryParse2017);
var valerio = wsAnno.Range("G1", "L" + lastRowNumber).Rows().Select(Movimento.TryParse2017);
var comune = wsAnno.Range("L1", "R" + lastRowNumber).Rows().Select(Movimento.TryParse2017);
var movimenti = laura.Concat(valerio).Concat(comune).Where(r => r != null).ToArray();
foreach (var movimento in movimenti)
{
dati.Cell(riga, "A").Value = movimento.Data;
dati.Cell(riga, "B").Value = movimento.Categoria;
dati.Cell(riga, "C").Value = movimento.Per;
dati.Cell(riga, "D").Value = movimento.Descrizione;
dati.Cell(riga, "E").Value = movimento.Spesa;
riga++;
}
return riga;
}
开发者ID:valeriob,项目名称:MyBudget,代码行数:19,代码来源:GeneraDaTemplate.cs
示例20: ProcessWorksheet
private void ProcessWorksheet(IXLWorksheet xlWorksheet)
{
if(!_uniqueIdIdMapping.Any() )
_uniqueIdIdMapping = _zoneService.GetAll().Select(i => new {i.UniqueId, i.Id}).ToDictionary(t => t.UniqueId, t => t.Id);
var rows = xlWorksheet.RowsUsed();
foreach (var row in rows)
{
var parentUniqueId = row.FirstCellUsed().GetString();
var parentId =
_uniqueIdIdMapping.FirstOrDefault(i => i.Key.Equals(parentUniqueId, StringComparison.InvariantCultureIgnoreCase)).Value;
var name = row.FirstCellUsed().CellRight().GetString();
var m = new StagedGroup()
{
ZoneId = parentId,
Name = name,
UniqueId = UniqueIdGenerator.GenerateUniqueIdForGroup(name)
};
_groupService.Insert(m);
}
}
开发者ID:edikep2000,项目名称:Zakar,代码行数:20,代码来源:GroupExcelFileHandler.cs
注:本文中的IXLWorksheet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论