本文整理汇总了C#中Worksheet.CreateAnchor方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.CreateAnchor方法的具体用法?C# Worksheet.CreateAnchor怎么用?C# Worksheet.CreateAnchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worksheet
的用法示例。
在下文中一共展示了Worksheet.CreateAnchor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteHistogramToSheet
private static void WriteHistogramToSheet(Worksheet sheet, IEnumerable<double> data)
{
// Throw delivery time into the histogram
Histogram hist = new Histogram(data, 60);
sheet[0, 0].Value = "Count";
sheet[0, 1].Value = "Width";
sheet[0, 2].Value = "LowerBound";
sheet[0, 3].Value = "UpperBound";
// Write the histogram data out to Excel
for (int i = 1; i < hist.BucketCount; i++)
{
sheet[i, 0].Value = hist[i].Count;
sheet[i, 1].Value = hist[i].Width;
sheet[i, 2].Value = hist[i].LowerBound;
sheet[i, 3].Value = hist[i].UpperBound;
}
// Plot the histogram data
Charts charts = sheet.Charts;
Anchor anchor = sheet.CreateAnchor(4, 6, 0, 0);
Chart chart = charts.CreateChart(ChartType.Column.Clustered, anchor);
SeriesCollection collection = chart.SeriesCollection;
collection.CategoryData = String.Format("{0}!{1}:{2}", sheet.Name, sheet.Cells[1, 2].Name, sheet.Cells[50, 2].Name);
Series series = collection.CreateSeries(String.Format("{0}!{1}:{2}", sheet.Name, sheet.Cells[1, 0].Name, sheet.Cells[50, 0].Name));
}