473,727 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PowerPoint Table C#

3 New Member
Hi Guys,

What i want to do is:

I want to create a Slide programmaticall y 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 11894
chrizstone
3 New Member
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
568
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 Windows clipboard. Then, using automation, I am trying to copy this information from the clipboard to a PowerPoint slide. However, I get an error at slide.Shapes.PasteSpecial. I am able create a System.Drawing.Bitmap object from the memory...
6
3409
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 because sometimes Powerpoint is remaining running (powerpnt.exe in Task Manager). One action of my smart tags calls InsertChart (code below). The designated line causes powerpoint to remain running even after the user has manually closed the...
4
42143
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 th transition between the 3 presentations. Let us say I have three powerpoint presentation Presentation 1 Presentation 2, and Presentation 3. I like to fire them from a window form on the click event of a butto on the form. The sequence of...
0
12413
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 paste as an Excel object in power point which links the Excel file to the power point, but this increases the file size. Microsoft Power point has a feature called Microsoft charts that allows to create charts and graphs in
8
7075
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 = Office.MsoTriState.msoTrue pp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized Application.DoEvents()
0
4056
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 easier for my users (and harder for myself). Every week my secretary exports different sets of data into Excel (via cmd buttons on form) then copies and pastes the data into powerpoint slides for our weekly staff meeting. I want to simplify this...
0
1163
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 any one help me to get all text from slide For Each pptSlide In pptDoc.Slides shapes1 = pptSlide.Shapes
4
3264
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 create a gridview from a Web application to an automated powerpoint slide. If that is not possible, then reading the gridview items to a table created in powerpoint, all in C#. Have searched Google many times, results ranged from "can't be
0
9406
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6703
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4786
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.