DocumentBuilderInsertChart Method (ChartType, RelativeHorizontalPosition, Double, RelativeVerticalPosition, Double, Double, Double, WrapType) |
Inserts an chart object into the document and scales it to the specified size.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic Shape InsertChart(
ChartType chartType,
RelativeHorizontalPosition horzPos,
double left,
RelativeVerticalPosition vertPos,
double top,
double width,
double height,
WrapType wrapType
)
Public Function InsertChart (
chartType As ChartType,
horzPos As RelativeHorizontalPosition,
left As Double,
vertPos As RelativeVerticalPosition,
top As Double,
width As Double,
height As Double,
wrapType As WrapType
) As Shape
public:
Shape^ InsertChart(
ChartType chartType,
RelativeHorizontalPosition horzPos,
double left,
RelativeVerticalPosition vertPos,
double top,
double width,
double height,
WrapType wrapType
)
member InsertChart :
chartType : ChartType *
horzPos : RelativeHorizontalPosition *
left : float *
vertPos : RelativeVerticalPosition *
top : float *
width : float *
height : float *
wrapType : WrapType -> Shape
Parameters
- chartType
- Type: Aspose.Words.Drawing.ChartsChartType
The chart type to insert into the document. - horzPos
- Type: Aspose.Words.DrawingRelativeHorizontalPosition
Specifies where the distance to the image is measured from. - left
- Type: SystemDouble
Distance in points from the origin to the left side of the image. - vertPos
- Type: Aspose.Words.DrawingRelativeVerticalPosition
Specifies where the distance to the image measured from. - top
- Type: SystemDouble
Distance in points from the origin to the top side of the image. - width
- Type: SystemDouble
The width of the image in points. Can be a negative or zero value to request 100% scale. - height
- Type: SystemDouble
The height of the image in points. Can be a negative or zero value to request 100% scale. - wrapType
- Type: Aspose.Words.DrawingWrapType
Specifies how to wrap text around the image.
Return Value
Type:
ShapeThe image node that was just inserted.
RemarksYou can change the image size, location, positioning method and other settings using the
Shape object returned by this method.
ExamplesShows how to insert a chart into a document and specify position and size.
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.doc");
See Also