473,408 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 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 11784
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.