J
Jeff Donkersgoed
I have some charts that I create through C# code on a "template" worksheet
and then copy it over to a new worksheet using the following code. When
looking at the chart.Shapes, I can see the three Textbox objects that I want
and these are the only shapes available. I can see them on the screen in
both Excel 2003 and 2007 correctly. When I print in 2003 though, the
textboxes don't appear like they do for 2007. Can anyone shed some light on
why this might be happening?
// Copy the images and charts (note index starts at 1)
for (int z = 1; z <= wsTemplate.Shapes.Count; z++)
{
((Excel.Shape)wsTemplate.Shapes.Item(z)).Copy();
wsClientPatient.get_Range("A1", "A1").Activate();
((Excel.Worksheet)app.ActiveSheet).Paste(Missing.Value, Missing.Value);
}
for (int chartNum = 1; chartNum <= 2; chartNum++)
{
chart = ((Excel.ChartObject)wsClientPatient.ChartObjects(chartNum)).Chart;
chart.ChartArea.Top = (chartNum == 1) ? 868 : 1047;
chart.ChartArea.Left = 25;
// Temporary test
for (int z = 1; z <= chart.Shapes.Count; z++)
{
object y = chart.Shapes.Item(z);
Microsoft.Office.Core.MsoShapeType yy = chart.Shapes.Item(z).Type;
}
}
and then copy it over to a new worksheet using the following code. When
looking at the chart.Shapes, I can see the three Textbox objects that I want
and these are the only shapes available. I can see them on the screen in
both Excel 2003 and 2007 correctly. When I print in 2003 though, the
textboxes don't appear like they do for 2007. Can anyone shed some light on
why this might be happening?
// Copy the images and charts (note index starts at 1)
for (int z = 1; z <= wsTemplate.Shapes.Count; z++)
{
((Excel.Shape)wsTemplate.Shapes.Item(z)).Copy();
wsClientPatient.get_Range("A1", "A1").Activate();
((Excel.Worksheet)app.ActiveSheet).Paste(Missing.Value, Missing.Value);
}
for (int chartNum = 1; chartNum <= 2; chartNum++)
{
chart = ((Excel.ChartObject)wsClientPatient.ChartObjects(chartNum)).Chart;
chart.ChartArea.Top = (chartNum == 1) ? 868 : 1047;
chart.ChartArea.Left = 25;
// Temporary test
for (int z = 1; z <= chart.Shapes.Count; z++)
{
object y = chart.Shapes.Item(z);
Microsoft.Office.Core.MsoShapeType yy = chart.Shapes.Item(z).Type;
}
}