本文整理汇总了C#中NetOffice.Range方法的典型用法代码示例。如果您正苦于以下问题:C# NetOffice.Range方法的具体用法?C# NetOffice.Range怎么用?C# NetOffice.Range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetOffice
的用法示例。
在下文中一共展示了NetOffice.Range方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCompetitorListWorksheet
protected void CreateCompetitorListWorksheet(NetOffice.ExcelApi.Worksheet worksheet)
{
var competitors = _reporter.GetCompetitors()
.OrderBy(x => x.LastName);
var row = 1;
worksheet.Name = "Competitor List";
PrintWorksheetTitle("Competitor List", worksheet, row++);
var startRow = row;
PrintTableColumnNames(worksheet, Competitor.TableFullColumnNames(), row++);
foreach (var competitor in competitors)
{
PrintTableColumnData(worksheet, competitor.TableFullRowData(), row++);
}
var endRow = row - 1;
string firstCol = ExcelColumnFromNumber(1);
string lastCol = ExcelColumnFromNumber(Competitor.TableFullColumnNames().Length);
worksheet.Columns[firstCol + ":" + lastCol].AutoFit();
var tableRange = worksheet.Range(
worksheet.Cells[startRow, firstCol],
worksheet.Cells[endRow, lastCol]);
var table = worksheet.ListObjects.Add(
NetOffice.ExcelApi.Enums.XlListObjectSourceType.xlSrcRange,
tableRange,
Type.Missing,
NetOffice.ExcelApi.Enums.XlYesNoGuess.xlYes,
Type.Missing);
table.Name = "CompetitorList";
}
示例2: PrintGroupHeader
protected void PrintGroupHeader(string groupTitle, NetOffice.ExcelApi.Worksheet worksheet, int row)
{
worksheet.Cells[row, "A"].Value = groupTitle;
worksheet.Cells[row, "A"].Font.Size = GroupFontSize;
worksheet.Cells[row, "A"].Interior.Color = ColorToDouble(Colors.LightGray);
worksheet.Range(worksheet.Cells[row, "A"], worksheet.Cells[row, "D"]).Merge();
}
示例3: PrintWorksheetTitle
protected void PrintWorksheetTitle(string title, NetOffice.ExcelApi.Worksheet worksheet, int row)
{
worksheet.Cells[row,"A"].Value = title;
worksheet.Cells[row,"A"].Font.Size = HeaderFontSize;
worksheet.Range(worksheet.Cells[row, "A"], worksheet.Cells[row, "F"]).Merge();
}
示例4: PutSampleData
private static NetOffice.ExcelApi.Range PutSampleData(NetOffice.ExcelApi.Worksheet workSheet)
{
workSheet.Cells[2, 2].Value = "Datum";
workSheet.Cells[3, 2].Value = DateTime.Now.ToShortDateString();
workSheet.Cells[4, 2].Value = DateTime.Now.ToShortDateString();
workSheet.Cells[5, 2].Value = DateTime.Now.ToShortDateString();
workSheet.Cells[6, 2].Value = DateTime.Now.ToShortDateString();
workSheet.Cells[2, 3].Value = "Columns1";
workSheet.Cells[3, 3].Value = 25;
workSheet.Cells[4, 3].Value = 33;
workSheet.Cells[5, 3].Value = 30;
workSheet.Cells[6, 3].Value = 22;
workSheet.Cells[2, 4].Value = "Column2";
workSheet.Cells[3, 4].Value = 25;
workSheet.Cells[4, 4].Value = 33;
workSheet.Cells[5, 4].Value = 30;
workSheet.Cells[6, 4].Value = 22;
workSheet.Cells[2, 5].Value = "Column3";
workSheet.Cells[3, 5].Value = 25;
workSheet.Cells[4, 5].Value = 33;
workSheet.Cells[5, 5].Value = 30;
workSheet.Cells[6, 5].Value = 22;
return workSheet.Range("$B2:$E6");
}