ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel.Chart size changes after copy-paste into Word (https://www.excelbanter.com/excel-programming/436033-excel-chart-size-changes-after-copy-paste-into-word.html)

fmamstr November 11th 09 03:44 AM

Excel.Chart size changes after copy-paste into Word
 
Hi There,

I met a problem about Excel.Chart. The scenario I'm experiencing as below:

I have an add-in for Word & PowerPoint, in which a hidden Excel process
is running as the source of content. Firstly I create an Excel Live Chart
inside Excel and manipulates its size by the following call:

Excel.Chart _chart =
(Excel.Chart)_workbook.Charts.Add(_missing, _missing, _missing, _missing);
_chart.PageSetup.ChartSize =
Microsoft.Office.Interop.Excel.XlObjectSize.xlScre enSize;
_chart.ChartArea.Width = width; // Specified width
_chart.ChartArea.Height = height; // Specified height

After the "Chart" is created, I will return to the host
application(Word/PowerPoint) and using copy-paste to the host application,
but here I met a problem. The final object's "Original Size" is not the size
that we specified in the above step, but the "Absolute Size" is what we
specified in the above step, since we are creating a "Pie" chart, so the
chart got skewed caused by the scaling. This problem only happens in Word
2007, not exists in Word 2003, PowerPoint 2003/2007.

The paste method we use in Word like below:

_app.Selection.Range.PasteSpecial(ref missing, ref link, ref placement, ref
displayAsIcon, ref dataType, ref missing, ref missing);

The data type is "OleObject".

Can anyone help on this problem? Thanks!







All times are GMT +1. The time now is 09:23 PM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
ExcelBanter.com