PC Review


Reply
Thread Tools Rate Thread

Confrimation of copy paste operation

 
 
GS80
Guest
Posts: n/a
 
      9th May 2008
Hi,

In my application (C#, Office 2007), i am attempting to copy a range of
cells containing data to a range on another worksheet. Upon copying the range
I then copy a chart into a specific area on the second worksheet. The chart
is resized and set up to represent a datapoint per row of data so the chart.

Occasionally (and i mean occasionally, i cannot replicate the problem 100%
of the time) the chart does not get copied to the second worksheet. I do this
a number of times for various different table ranges. Sometimes there will be
a number of these charts copied to the same output worksheet and i have
encountered this issue where by only some of the charts copy and others don't.

I generally use the following code to do the copy paste

_chObj = (ChartObject)_excelDataWS.ChartObjects("ChartName");
_chObj.Copy();
_excelPresentationWS.Paste(_presTopLeftRange), paramMissing);

I have a couple of questions on this problem.

1) Is there a benefit to using the following copy command?:
_chObj.CopyPicture(XlPictureAppearance.xlScreen,
XlCopyPictureFormat.xlPicture);

2) Is there any way to confirm that a copy/paste operation has succeeded and
if not then to retry it?

I'm really having no joy in diagnosing why this is happening. I get no
exceptions thrown when the charts do not appear.

Any help is greatfully recieved.

Thanks in advance,

G
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      9th May 2008
I believe a chart will always copy. I suspect the _chObj may be empty
(null). I would set _chObj to Null before you assign the chart, then test if
it is still null afterwards before you do the copy.

"GS80" wrote:

> Hi,
>
> In my application (C#, Office 2007), i am attempting to copy a range of
> cells containing data to a range on another worksheet. Upon copying the range
> I then copy a chart into a specific area on the second worksheet. The chart
> is resized and set up to represent a datapoint per row of data so the chart.
>
> Occasionally (and i mean occasionally, i cannot replicate the problem 100%
> of the time) the chart does not get copied to the second worksheet. I do this
> a number of times for various different table ranges. Sometimes there will be
> a number of these charts copied to the same output worksheet and i have
> encountered this issue where by only some of the charts copy and others don't.
>
> I generally use the following code to do the copy paste
>
> _chObj = (ChartObject)_excelDataWS.ChartObjects("ChartName");
> _chObj.Copy();
> _excelPresentationWS.Paste(_presTopLeftRange), paramMissing);
>
> I have a couple of questions on this problem.
>
> 1) Is there a benefit to using the following copy command?:
> _chObj.CopyPicture(XlPictureAppearance.xlScreen,
> XlCopyPictureFormat.xlPicture);
>
> 2) Is there any way to confirm that a copy/paste operation has succeeded and
> if not then to retry it?
>
> I'm really having no joy in diagnosing why this is happening. I get no
> exceptions thrown when the charts do not appear.
>
> Any help is greatfully recieved.
>
> Thanks in advance,
>
> G

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Paste operation stops working after some time =?Utf-8?B?VmlwdWw=?= Windows XP General 2 18th Apr 2007 07:18 PM
"ignoring" hidden cells in a copy/paste operation =?Utf-8?B?Z3Zt?= Microsoft Excel Misc 2 22nd Mar 2007 10:38 PM
Re: Change cut/paste operation to cut/insert operation Don Guillett Microsoft Excel Programming 0 17th Jan 2007 03:23 PM
What of these commands ruin my copy - paste operation between workbooks? Microsoft Excel Programming 2 4th May 2004 02:00 AM
Copy & Paste Object without using the Excel Copy Paste functions =?Utf-8?B?R2Fueg==?= Microsoft Excel Misc 0 10th Mar 2004 07:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:09 AM.