Creaing PowerPoint presentation with OpenXml - Absolute position of - Microsoft Community
- Get link
- X
- Other Apps
we're creating powerpoint presentations containing, among other things, line charts. in cases need draw arrow (or other shape) points specific point on chart, given point's (x,y)
values in chart.
to this, need absolute position of chart point, relative slide's top-left corner.
currently we're using interop calculate dimensions of chart's plot area, can calculate absolute position of given chart point, shown below:
// chart point's x- , y values double x = ... ; double y = ... ; powerpoint.shape shape = ... ; powerpoint.chart chart = shape.chart; double plotarealeft = shape.left + chart.chartarea.left + chart.plotarea.insideleft; double plotareatop = shape.top + chart.chartarea.top + chart.plotarea.insidetop; double plotareawidth = chart.plotarea.insidewidth; double plotareaheight = chart.plotarea.insideheight; // calculating range of x- , y values double xmin = ... ; double xrange = ... ; double ymin = ... ; double yrange = ... ; // calculating exact position of point double left = plotarealeft + (x - xmin) * plotareawidth / xrange; double top = plotareatop + (y - ymin) * plotareaheight / yrange;
now works fine, we're in process of moving application server, , switching interop openxml creating presentations.
the problem dimensions of plotarea not fixed, dynamically calculated powerpoint, , calculation seems depending on lot of factors including labels, font, legend, , users manually changing position of plotarea. we're trying reverse-engineer calculation, far haven't been able come solution hits target every time.
we have tried commercial frameworks, such aspose.slides, seem have same problem (the functionality listed in their api, values never calculated - have value of nan
).
my question thus: have or resources can use, or experiences solving problem?
thanks in advance.
hi alexander,
to better assistance concern, suggest post query on microsoft developer network forum. that, kindly click on link.
let know if have other concerns.
Office / PowerPoint / Microsoft Office Programming / Office 2010
- Get link
- X
- Other Apps
Comments
Post a Comment