Can't copy Charts (pivot) from one worksheet to another in Excel 2007

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Puffy
    New Member
    • Aug 2010
    • 2

    Can't copy Charts (pivot) from one worksheet to another in Excel 2007

    Using C#, I need to copy the contents of one worksheet (Excel.Workshee t) to another worksheet. Everything gets copied (including pivot charts) when I execute the code for the 1st time. But when I execute the code again, the charts (pivot charts) in the source worksheet dont get copied to the destination worksheet in Excel 2007. This works fine in Excel 2003.
    I'm using .NET 2.0!
    can you please help me on this...

    this is the code I'm using;

    Code:
    public static void copy(Excel.Worksheet src, Excel.Worksheet dest)
    {
       Excel.Range range;
       Excel.Range range2;
    
       range = src.get_Range(src.Cells[1, 1], src.Cells[src.Rows.Count, src.Columns.Count]); 
       range2 = dest.get_Range(dest.Cells[1, 1], dest.Cells[1, 1]);
       range.Copy(range2);
    }
    I posted the same question under the following thread as well "Copy worksheet not working" (microsoft access / vba), since it deals with the same issue.
Working...