public
void
BootPPT()
... {
_app = new PPT.ApplicationClass();
_app.Activate();
pptPre = _app.Presentations.Add(
Microsoft.Office.Core.MsoTriState.msoTrue);
pptPre.Slides.Add(1, PPT.PpSlideLayout.ppLayoutText);
pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text ="ssss" ;
pptPre.Slides[1].Shapes[2].TextFrame.TextRange.Text = "bbbb";
...#region
//_app = new PPT.ApplicationClass();
//_app.Activate();
//pptPre= _app.Presentations.Add(
//Microsoft.Office.Core.MsoTriState.msoTrue);
//slide = pptPre.Slides.Add(0, 0);
/**/////slide = slides[slides.Count-1];
//pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text = "test";
/**/////_app.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();
////pptPre = _app.Presentations.Add(MsoTriState.msoTrue);
#endregion
}
... {
_app = new PPT.ApplicationClass();
_app.Activate();
pptPre = _app.Presentations.Add(
Microsoft.Office.Core.MsoTriState.msoTrue);
pptPre.Slides.Add(1, PPT.PpSlideLayout.ppLayoutText);
pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text ="ssss" ;
pptPre.Slides[1].Shapes[2].TextFrame.TextRange.Text = "bbbb";
...#region
//_app = new PPT.ApplicationClass();
//_app.Activate();
//pptPre= _app.Presentations.Add(
//Microsoft.Office.Core.MsoTriState.msoTrue);
//slide = pptPre.Slides.Add(0, 0);
/**/////slide = slides[slides.Count-1];
//pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text = "test";
/**/////_app.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();
////pptPre = _app.Presentations.Add(MsoTriState.msoTrue);
#endregion
}
using
System;using
System.Collections.Generic;using
System.Text;using
PPT = Microsoft.Office.Interop.PowerPoint;using
ACCESS = Microsoft.Office.Interop.Access;using
Microsoft.Office.Core;using
System.Windows.Forms;using
System.Drawing;namespace
{
LnPPt class PPtObject
{
{
_app =
_app.Activate();
pptPre=_app.Presentations.Add(
Microsoft.Office.Core.
pptPre.Slides.Add(1,PPT.
pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text =
pptPre.Slides[1].Shapes[2].TextFrame.TextRange.Text =
_app.CommandBars[
private PPT. Application _app; private PPT. AutoCorrect _Auto; private PPT. Presentation pptPre; private PPT. AutoCorrect autoCorrect; public void BootPPT() new PPT. ApplicationClass (); MsoTriState .msoTrue); PpSlideLayout .ppLayoutText); "This is title!" ; "This is body!" ; "Tools" ].Controls[ "AutoCorrect Options..." ].Execute(); //pptPre.SaveAs("E://cofei//Documents//testppt.ppt",Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPowerPoint7,Microsoft.Office.Core.MsoTriState.msoFalse);
//_app.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();
}
{
public IntPtr hWnd get
{
}
}
{
}
return ( IntPtr )_app.HWND; public void EditAutoCorrect() //
{
PPT.
PPT.
Microsoft.Office.Core.
Microsoft.Office.Core.
Microsoft.Office.Core.
open a ppt file
*********************************/
public void pptopen() string filename = "C://Documents and Settings//Administrator//Desktop//cofei//Presentation1.ppt" ; Application pa = new PPT. ApplicationClass (); Presentation pp = pa.Presentations.Open(filename, MsoTriState .msoTrue, MsoTriState .msoFalse, MsoTriState .msoFalse); /******************************//PPT.Application pa = new PPT.ApplicationClass();
//pa.Activate();
//pa.Presentations.Open(filename,
// Microsoft.Office.Core.MsoTriState.msoTrue,
// Microsoft.Office.Core.MsoTriState.msoFalse,
// Microsoft.Office.Core.MsoTriState.msoFalse);
//pa.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();
string [] strKeyWordList ={ "bbbbbb" }; //要搜索的文本
PPT.
{
{
{
oText =
TextRange oText; foreach (PPT. Slide slide in pp.Slides) foreach (PPT. Shape shape in slide.Shapes) foreach ( string strKeyWord in strKeyWordList) null ; //oText = shape.TextFrame.TextRange.Find(strKeyWord, 0, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue);
oText = shape.TextFrame.TextRange;
MessageBox .Show(oText.Text.ToString()); //if (oText != null)
//{
// MessageBox.Show("文档中包含指定的关键字 " + strKeyWord + " !", "搜索结果", MessageBoxButtons.OK);
// continue;
//}
//else
//{
// MessageBox.Show("文档中不包含指定的关键字 " + strKeyWord + " !", "搜索结果", MessageBoxButtons.OK);
// continue;
//}
}
}
}
}
}
}