saya punya satu file powerpoint, nah didalamnya ada satu slide yang mengandung chart ...
nah, chart itu mau saya ganti dan saya samakan dengan chart yang ada di file excel yang saya punya.
saya mau menyamakan chart tersebut menggunakan C# .
nah, script yang saya punya untuk mengupdate chart yang di excel ke powerpoint adalah ini
- Code: Select all
powerpointApplication = new pptNS.ApplicationClass();
// Create an instance Excel.
excelApplication = new xlNS.ApplicationClass();
// Open the Excel workbook containing the worksheet with the chart data.
excelWorkBook = excelApplication.Workbooks.Open(paramWorkbookPath,
paramMissing, paramMissing, paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing, paramMissing);
// Get the worksheet that contains the chart.
targetSheet =
(xlNS.Worksheet)(excelWorkBook.Worksheets["" + textBox1.Text + ""]);
// Get the ChartObjects collection for the sheet.
chartObjects =
(xlNS.ChartObjects)(targetSheet.ChartObjects(paramMissing));
// Get the chart to copy.
existingChartObject =
(xlNS.ChartObject)(chartObjects.Item("" + textBox2.Text + ""));
powerpointApplication.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue;
pptNS.Presentations pres = powerpointApplication.Presentations;
pptNS._Presentation opres = pres.Open(@"" + textBox5.Text + "", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue);
// Add a blank slide to the presentation.
pptSlide =
pptPresentation.Slides.Add(1, pptNS.PpSlideLayout.ppLayoutBlank);
// Copy the chart from the Excel worksheet to the clipboard.
existingChartObject.Copy();
// Paste the chart into the PowerPoint presentation.
shapeRange = pptSlide.Shapes.Paste();
// Position the chart on the slide.
shapeRange.Left = 115;
shapeRange.Top = 95;
shapeRange.Width = 500;
shapeRange.Height = 350;
tapi karena chart yang mau saya update itu sudah ada didalam slide yang ada di powerpoint, bagaimana cara mengupdatenya ?
sedangkan script yang ini...
- Code: Select all
// Add a blank slide to the presentation.
pptSlide =
pptPresentation.Slides.Add(1, pptNS.PpSlideLayout.ppLayoutBlank);
itu untuk menambah slide,,,
mohon bantuan nya semoga rekanrekan bisa membantu, terimakasih..


