本文整理汇总了C#中IXLWorksheet.Cell方法的典型用法代码示例。如果您正苦于以下问题:C# IXLWorksheet.Cell方法的具体用法?C# IXLWorksheet.Cell怎么用?C# IXLWorksheet.Cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXLWorksheet
的用法示例。
在下文中一共展示了IXLWorksheet.Cell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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++;
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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++;
}
示例6: AddColumn
public void AddColumn(string sheetName, string colName)
{
worksheet = workbook.Worksheet(sheetName);
if(worksheet.LastColumnUsed()!=null)
worksheet.LastColumnUsed().ColumnRight().Cell(1).Value = colName;
else
worksheet.Cell("A1").Value = colName;
Save();
}
示例7: 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;
}
}
示例8: 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;
}
示例9: Format
public void Format(IXLWorksheet worksheet, Step step, ref int row)
{
// Add comments
if (step.Comments.Any(o => o.Type == CommentType.StepComment))
{
foreach (var comment in step.Comments.Where(o => o.Type == CommentType.StepComment))
{
worksheet.Cell(row, "C").Style.Font.SetItalic();
worksheet.Cell(row, "C").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left);
worksheet.Cell(row, "C").Value = comment.Text;
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.Comments.Any(o => o.Type == CommentType.AfterLastStepComment))
{
foreach (var comment in step.Comments.Where(o => o.Type == CommentType.AfterLastStepComment))
{
worksheet.Cell(row, "C").Style.Font.SetItalic();
worksheet.Cell(row, "C").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left);
worksheet.Cell(row, "C").Value = comment.Text;
row++;
}
}
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);
}
}
示例10: Format
public void Format(IXLWorksheet worksheet, Scenario scenario, ref int row)
{
int originalRow = row;
worksheet.Cell(row, "B").Style.Font.SetBold();
worksheet.Cell(row++, "B").Value = scenario.Name;
worksheet.Cell(row++, "C").Value = scenario.Description;
var results = this.testResults.GetScenarioResult(scenario);
if (this.configuration.HasTestResults && results.WasExecuted)
{
worksheet.Cell(originalRow, "B").Style.Fill.SetBackgroundColor(
results.WasSuccessful
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
foreach (Step step in scenario.Steps)
{
this.excelStepFormatter.Format(worksheet, step, ref row);
}
}
示例11: 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 = testResults.GetScenarioOutlineResult(scenarioOutline);
if (configuration.HasTestResults && results.WasExecuted)
{
worksheet.Cell(originalRow, "B").Style.Fill.SetBackgroundColor(results.WasSuccessful
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
foreach (Step step in scenarioOutline.Steps)
{
excelStepFormatter.Format(worksheet, step, ref row);
}
row++;
worksheet.Cell(row++, "B").Value = "Examples";
excelTableFormatter.Format(worksheet, scenarioOutline.Example.TableArgument, ref row);
}
示例12: 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++;
}
}
示例13: SetPhasesData
private static void SetPhasesData(IXLWorksheet ws, List<PhaseModel> phases, int currentRow, ref int currentColumn)
{
foreach (var phase in phases)
{
ws.Cell(currentRow, currentColumn).Value = phase.Percentage;
currentColumn++;
}
}
示例14: SetOxidesTable
private static void SetOxidesTable(IXLWorksheet ws)
{
var mainOxides = Model.OxidesResultModel.First().OxidesResult.Select(x => x.Oxide.Formula);
var oxides = Model.Oxides.Where(x => !mainOxides.Contains(x.Composition.Formula));
var countInsert = oxides.Count() - 3;
if (countInsert > 0)
{
ws.Column("AV").InsertColumnsAfter(oxides.Count() - 3);//44 - 51 template column
ws.Range(5, 44, 8, 51 + countInsert).Merge();
ws.Range(18, 44, 18, 50 + countInsert).Merge();
}
var currentCol = 48;
foreach (var oxide in oxides)
{
var currentCell = ws.Cell(9, currentCol);
currentCell.Style.Border.RightBorder = XLBorderStyleValues.Thin;
currentCell.Style.Border.LeftBorder = XLBorderStyleValues.Thin;
SetChemicalFormula(currentCell.RichText, oxide.Composition.Formula);
var currentResCell = ws.Cell(19, currentCol);
SetChemicalFormula(currentResCell.RichText, oxide.Composition.Formula);
currentCol++;
}
}
示例15: SetOxidesBySystem
private static void SetOxidesBySystem(
IXLWorksheet ws,
List<OxideResultModel> oxides,
int currentRow,
ref int currentColumn)
{
foreach (var oxide in oxides)
{
ws.Cell(currentRow, currentColumn).Value = oxide.Percentage;
currentColumn++;
}
}