InsertChart
内容
[
隐藏
]InsertChart(ChartType, double, double)
将图表对象插入文档并将其缩放到指定大小。
public Shape InsertChart(ChartType chartType, double width, double height)
范围 | 类型 | 描述 |
---|---|---|
chartType | ChartType | 要插入到文档中的图表类型。 |
width | Double | 图像的宽度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
height | Double | 图像的高度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
返回值
刚刚插入的图像节点。
评论
您可以使用 更改图像大小、位置、定位方法和其他设置Shape
此方法返回的对象。
例子
展示如何将饼图插入文档。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Chart chart = builder.InsertChart(ChartType.Pie, ConvertUtil.PixelToPoint(300),
ConvertUtil.PixelToPoint(300)).Chart;
chart.Series.Clear();
chart.Series.Add("My fruit",
new[] { "Apples", "Bananas", "Cherries" },
new[] { 1.3, 2.2, 1.5 });
doc.Save(ArtifactsDir + "DocumentBuilder.InsertPieChart.docx");
也可以看看
- class Shape
- enum ChartType
- class DocumentBuilder
- 命名空间 Aspose.Words
- 部件 Aspose.Words
InsertChart(ChartType, double, double, ChartStyle)
将图表对象插入文档并将其缩放到指定大小。
public Shape InsertChart(ChartType chartType, double width, double height, ChartStyle chartStyle)
范围 | 类型 | 描述 |
---|---|---|
chartType | ChartType | 要插入到文档中的图表类型。 |
width | Double | 图像的宽度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
height | Double | 图像的高度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
chartStyle | ChartStyle | 插入图表的样式。 |
返回值
刚刚插入的图像节点。
评论
您可以使用 更改图像大小、位置、定位方法和其他设置Shape
此方法返回的对象。
也可以看看
- class Shape
- enum ChartType
- enum ChartStyle
- class DocumentBuilder
- 命名空间 Aspose.Words
- 部件 Aspose.Words
InsertChart(ChartType, RelativeHorizontalPosition, double, RelativeVerticalPosition, double, double, double, WrapType)
将图表对象插入文档并将其缩放到指定大小。
public Shape InsertChart(ChartType chartType, RelativeHorizontalPosition horzPos, double left,
RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType)
范围 | 类型 | 描述 |
---|---|---|
chartType | ChartType | 要插入到文档中的图表类型。 |
horzPos | RelativeHorizontalPosition | 指定从哪里测量到图像的距离。 |
left | Double | 从原点到图像左侧的距离(以点为单位)。 |
vertPos | RelativeVerticalPosition | 指定从哪里测量到图像的距离。 |
top | Double | 从原点到图像顶部的距离(以点为单位)。 |
width | Double | 图像的宽度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
height | Double | 图像的高度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
wrapType | WrapType | 指定如何让文本环绕图像。 |
返回值
刚刚插入的图像节点。
评论
您可以使用 更改图像大小、位置、定位方法和其他设置Shape
此方法返回的对象。
例子
显示如何在插入图表时指定位置和换行。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertChart(ChartType.Pie, RelativeHorizontalPosition.Margin, 100, RelativeVerticalPosition.Margin,
100, 200, 100, WrapType.Square);
doc.Save(ArtifactsDir + "DocumentBuilder.InsertedChartRelativePosition.docx");
也可以看看
- class Shape
- enum ChartType
- enum RelativeHorizontalPosition
- enum RelativeVerticalPosition
- enum WrapType
- class DocumentBuilder
- 命名空间 Aspose.Words
- 部件 Aspose.Words
InsertChart(ChartType, RelativeHorizontalPosition, double, RelativeVerticalPosition, double, double, double, WrapType, ChartStyle)
将图表对象插入文档并将其缩放到指定大小。
public Shape InsertChart(ChartType chartType, RelativeHorizontalPosition horzPos, double left,
RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType,
ChartStyle chartStyle)
范围 | 类型 | 描述 |
---|---|---|
chartType | ChartType | 要插入到文档中的图表类型。 |
horzPos | RelativeHorizontalPosition | 指定从哪里测量到图像的距离。 |
left | Double | 从原点到图像左侧的距离(以点为单位)。 |
vertPos | RelativeVerticalPosition | 指定从哪里测量到图像的距离。 |
top | Double | 从原点到图像顶部的距离(以点为单位)。 |
width | Double | 图像的宽度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
height | Double | 图像的高度(以磅为单位)。可以为负值或零,以请求 100% 缩放。 |
wrapType | WrapType | 指定如何让文本环绕图像。 |
chartStyle | ChartStyle | 插入图表的样式。 |
返回值
刚刚插入的图像节点。
评论
您可以使用 更改图像大小、位置、定位方法和其他设置Shape
此方法返回的对象。
也可以看看
- class Shape
- enum ChartType
- enum RelativeHorizontalPosition
- enum RelativeVerticalPosition
- enum WrapType
- enum ChartStyle
- class DocumentBuilder
- 命名空间 Aspose.Words
- 部件 Aspose.Words