473,394 Members | 2,002 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,394 software developers and data experts.

how do i copy excel table as object in power point using c#

Hi,

I have a some information i.e. is in Table format in Excel
I want to insert that Table into power point
using C#
how do i do that
Please help

i've also added the snap shot of table

thank you
Attached Images
File Type: jpg table.jpg (20.4 KB, 849 views)
Mar 2 '10 #1
7 7416
tlhintoq
3,525 Expert 2GB
What have you coded/tried so far? Please so use what you are trying right now along with any error/exception you are getting.
Mar 2 '10 #2
Here is the code
that i've been using
i'm able to insert the data into excel
now after inserting those data
i want to bring that whole table in power point
something like ChartObject

thank you
Attached Files
File Type: txt code.txt (1.6 KB, 1200 views)
Mar 2 '10 #3
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.


Just copy/paste your code for extracting the table, along with the error message you are getting. Don't attache a file of your entire project. Just the code that is giving you trouble.
Mar 2 '10 #4
Here is the code

Expand|Select|Wrap|Line Numbers
  1. protected void CreatePowerPointSlideFromExcelTemplate()
  2.     {
  3.         excelApp = new Excel.Application();
  4.  
  5.         excelApp.Visible = true;
  6.         string templatePath = MapPath("ChartTemplate.xlsx");
  7.  
  8.         object missing = System.Type.Missing;
  9.  
  10.         Excel.Workbook objWorkbook = excelApp.Workbooks.Open(templatePath, missing);
  11.  
  12.  
  13.         Excel.Worksheet wSheetTest = (Excel.Worksheet)objWorkbook.Sheets["testTable1"]; //test Table
  14.  
  15.  
  16. // HERE I WANT TO CAPTURE THAT TABLE IN PICTURE AS SOME KIND OF OBJECT // SO THAT I CAN ADD IT IN POWERPOINT SLIDE
  17.        CreateChartBasedOnEnteredValues(wSheetTest, "testTable");
  18.  
  19.  
  20.  
  21.         CreateSlideForGraph(CreateChartBasedOnEnteredValues(wSheetTest, "testTable"));
  22.  
  23.         // Close and release the Excel Workbook object.
  24.         if (objWorkbook != null)
  25.         {
  26.             objWorkbook.Close(false, missing, missing);
  27.             objWorkbook = null;
  28.         }
  29.  
  30.         // Quit Excel and release the ApplicationClass object.
  31.         if (excelApp != null)
  32.         {
  33.             excelApp.Quit();
  34.             excelApp = null;
  35.         }
  36.  
  37.  
  38.  
  39.     }
  40.  
  41.  
  42.  
  43. protected CreateTableBasedOnEnteredValues(Excel.Worksheet wSheet, string chartName, string lbl1, string fy1Qtr1, string fy1Qtr2, string fy1Qtr3, string fy1Qtr4, string lbl2, string fy2Qtr1, string fy2Qtr2, string fy2Qtr3, string fy2Qtr4)
  44.     {
  45.         Object missing = System.Type.Missing;
  46.  
  47.  
  48.         wSheet.get_Range("B3", "B3").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  49.         wSheet.get_Range("C3", "C3").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  50.         wSheet.get_Range("D3", "D3").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  51.         wSheet.get_Range("F3", "F3").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  52.  
  53.         wSheet.get_Range("B4", "B4").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  54.         wSheet.get_Range("C4", "C4").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  55.         wSheet.get_Range("D4", "D4").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  56.         wSheet.get_Range("F4", "F4").set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, "test");
  57.  
  58.         Excel.ChartObjects chartObjects = (Excel.ChartObjects)(wSheet.ChartObjects(missing));
  59.         Excel.ChartObject objChart = (Excel.ChartObject)(chartObjects.Item(chartName));
  60.  
  61.  
  62.     }
  63.  
  64.  
  65.  
  66.  
  67.  
Mar 3 '10 #5
tlhintoq
3,525 Expert 2GB
// HERE I WANT TO CAPTURE THAT TABLE IN PICTURE AS SOME KIND OF OBJECT // SO THAT I CAN ADD IT IN POWERPOINT SLIDE
This is not exactly what we here at Bytes consider your own effort to code this, before asking for help.

Its more like you are asking for someone to just give you the code to do it.

Can anybody send me code to [...]
The Bytes volunteers are not here to write your code for you. This is not a free homework service.
Bytes is very much a "Give me a fish I eat for a day. Teach me to fish I eat for a lifetime" kind of place. Just giving you the code doesn't help you learn near as effectively as good old-fashioned trial and error.

Do a little reading up and experimenting then if your trials aren't doing what you expect, post the code and relevant messages/errors and we'll see what we can do to point you in the right direction for making it work.

Try hitting Google with terms of your programming language and primary terms of what you want to do. For example "C# custom events" or "VB datagrid Excel". I've found this to be a very effective tool.

May I suggest
  • First: Do some research. I heard about thing thing called Google, or books even.
  • Second: Do some experiments yourself. You will learn so much from actually trying it before throwing up your hands in defeat before even starting.
  • Third: Show the volunteers here the code that you created that was the closest to successful along with relevant errors.
Mar 3 '10 #6
sorry for the inconvenience.
I really appreciate your help and time.
Its not that i've given up
but at this point i'm not able to go any further.
so i had to go other way
i.e. creating table object directly in PowerPoint
but doing this really slows down the performance

For getting that excel table as an object i had done lots of trial and error method
but got no where

thank you
Mar 3 '10 #7
Niheel
2,460 Expert Mod 2GB
You can use the Open XML Format SDK to move data from one type of office document to another.

There is more information available here:
http://msdn.microsoft.com/en-us/library/dd440953.aspx

What is the Open XML Format SDK?
The Open XML Format SDK provides a set of Microsoft .NET Framework application programming interfaces (APIs) that allows you to create and manipulate documents in both client and server environments by using the Open XML Formats without requiring Microsoft Office client applications.
Mar 3 '10 #8

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

Similar topics

0
by: Jeff | last post by:
I will start off by giving you a background of the process I am taking. The nature of my DTS package is that I recieve an Excel Spreadsheet, run it through the DTS Package applying validation to...
3
by: cv | last post by:
Hi all, I have to copy two set of data from 2 files(notepad/excel) say, products and their corresponding prices to list/textarea/table. I should be able to retrieve the product and corresponding...
2
by: Alvin Bruney | last post by:
anybody know how to launch desktop excel from a webpage and feed it either a dataset or a file? i've got MS sample code but it aint compiling with the office 10 library. i wonder if they changed...
6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
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...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
0
by: yuenli | last post by:
Hi! I am using Microsoft Office Interop Power Point to build a Power Point Automation program. Does anyone know how to insert a table in the power point slide using the above object library?...
7
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can...
0
by: Omer | last post by:
I am trying to create a shared addin using visual studio 2005 with the following code. It is working only in Power Point Appliction and not loading in Excel and Word I used the Visual Studio Wizard...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.