View Single Post
  #1   Report Post  
Old November 11th 09, 03:44 AM posted to microsoft.public.excel.programming
fmamstr fmamstr is offline
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2010
Posts: 6
Default 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!