472,960 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

PowerPoint Table C#

Hi Guys,

What i want to do is:

I want to create a Slide programmatically where a Table is on it! Here´s my Code:

Expand|Select|Wrap|Line Numbers
  1. String strTemplate;
  2.             strTemplate = template;
  3.             String tableSlide = @"C:\Temp\TableSlide_" + guid.ToString();
  4.  
  5.             PowerPoint.Application objApp;
  6.             PowerPoint.Presentations objPresSet;
  7.             PowerPoint._Presentation objPres;
  8.             PowerPoint.Slides objSlides;
  9.             PowerPoint._Slide objSlide;
  10.             PowerPoint.TextRange objTextRng;
  11.  
  12.             //Create a new presentation based on a template.
  13.             objApp = new PowerPoint.Application();
  14.             objApp.Visible = MsoTriState.msoTrue;
  15.             objPresSet = objApp.Presentations;
  16.             objPres = objPresSet.Open(strTemplate,
  17.                 MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
  18.             objSlides = objPres.Slides;
  19.  
  20.  
  21.             //Build Slide #1:
  22.             //Add text to the slide, change the font and insert/position a
  23.             //picture on the first slide.
  24.             objSlide = objSlides.Add(1,PowerPoint.PpSlideLayout.ppLayoutTable);
  25.             objSlide.HeadersFooters.Footer.Visible = MsoTriState.msoTrue;
  26.             objSlide.HeadersFooters.Footer.Text = "hallo";
  27.  
  28.  
  29.             objSlide.HeadersFooters.DateAndTime.Visible = MsoTriState.msoTrue;
  30.             objSlide.HeadersFooters.DateAndTime.UseFormat = MsoTriState.msoTrue;
  31.             objSlide.HeadersFooters.DateAndTime.Format = Microsoft.Office.Interop.PowerPoint.PpDateTimeFormat.ppDateTimeddddMMMMddyyyy;
  32.             objSlide.HeadersFooters.SlideNumber.Visible = MsoTriState.msoTrue;
  33.             objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
  34.             objTextRng.Text = title;
  35.  
  36.  
  37.             // insert a PowerPoint table
  38.             // use data from a file
  39.             PowerPoint.Table objTable = null;
  40.  
  41.             objTable= objSlide.Shapes.AddTable(4,4,36,138,648,294).Table;
  42.  
  43.  
  44.             objTable.Cell(1,1).Shape.TextFrame.TextRange.Text = "Stundennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn";
  45.             objTable.Cell(1, 2).Shape.TextFrame.TextRange.Text = "Fach";
  46.             objTable.Cell(1, 3).Shape.TextFrame.TextRange.Text = "Note";
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.             objPres.SaveAs(tableSlide, Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoCTrue);
  54.             //Close the presentation without saving changes and quit PowerPoint.
  55.             objPres.Close();
  56.             objApp.Quit();
But if the String in Cell (1,1)for example, is very long then i want that the cell weigth goes bigger automatically! how can i do this?

Sorry for my bad english...:)
Nov 13 '09 #1
1 11683
No One? Can anybody help me?
Nov 16 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the...
6
by: C Williams | last post by:
Hi, I am writing some VB.NET code that compiles to a dll. There is some code within it that manipulates Powerpoint 2003. The dll I am writing is for smart tags, and I am having trouble...
4
by: Joseph | last post by:
I am trying to open a 3 powerpoint presentation simultaneously afte each other without interruption, the operator of the application doe not need to notice anything or interfere in the operation of...
0
by: Rach | last post by:
Hi, Does anyone know how to export charts/graphs from EXCEl into Powerpoint-Microsoft Charts though VBA code. I would like to import the underlying data with the chart as well. I know we can...
8
by: Rut | last post by:
Does anyone know how to start powerpoint from vb.net without the ppt screen appearing. I want to keep it hidden? Using this code: Try pp = New PowerPoint.Application pp.Visible =...
0
by: Rob | last post by:
Hey folks, my mind is turning into mush... I created a report tracking program in access that works beyond my greatest expectations. So of course, I am constantly adding features to make life...
0
by: akshar108 via DotNetMonster.com | last post by:
TextFrame (unknown member) : Invalid request. This type of shape cannot have a TextRange i got this error while i m fetching text from textframe which is in the slide my code is following can...
4
by: HibernatingBear | last post by:
Hello, I've been driving myself nuts trying to find a solution to this. I'm still a relative newbie to C#, and would be grateful for any helpful suggestions. I'm trying to find a way to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.