How to hide excel when changing the chart data through program

D

Deepak

Hello

I am using Office 2007 SP2. I am changing chart data using code.
shape.Chart.ChartData.Activate();
newWorkbook = shape.Chart.ChartData.Workbook as
MSExcel.Workbook;
targetSheet = (MSExcel.Worksheet)(newWorkbook.Worksheets[1]);
.....//Code to chage the data

it is working fine but only issue is: it is opening excel and chaging the
data.

Is there any way i can hide the excel and change the data in background?
 
L

Luca Brasi

There is now way to prevent Excel from starting when you try to change the
chart data. But after having adjusted the data you could add code to close
the workbook again. You could even set the workbook window invisible right
after calling the "Activate" method. The workbook would then be visible for
just a very short instant.

If that's not enough, try to define the PP application as the topmost window
for this short moment (in VBA this could be done using some Win32 api calls,
so I guess it's possible in VS too). Excel should then start in the
background and be visible just on the taskbar. Maybe there are even calls
that freeze the screen completely (I do not know)?

Maybe you even want to have a look at the Office Open XML (OOXML) standard
and how to use it programmatically (changing data directly in the pptx file,
without having to open it in PP).

Luca
 

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