Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Charting / April 2008

Tip: Looking for answers? Try searching our database.

Textbox on chart doesn't print in Office 2003, but does in 2007

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Donkersgoed - 28 Apr 2008 18:19 GMT
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;
   }
}
Jeff Donkersgoed - 29 Apr 2008 15:32 GMT
I think I'm getting a bit closer...in Excel 2003, I discovered that the
"Print object" checkbox wasn't checked on my textboxes.  Checking it allowed
them to show up in the print preview.  Does anyone know how to set this in
code?  I tried below, but the property was already set to true, so I don't
think it's the right spot.  I can't find a similar checkbox in Excel 2007 to
verify.

for (int z = 1; z <= chart.Shapes.Count; z++)
{
   chart.Shapes.Item(z).ControlFormat.PrintObject = true;
}

> 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
[quoted text clipped - 25 lines]
>     }
> }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.