Excel.Chart size changes after copy-paste into Word

F

fmamstr

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.xlScreenSize;
_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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top