国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
C#播放PPT
如何在Visual C# .NET中使用自動化創(chuàng)建并顯示PowerPoint演示文稿為 PowerPoint 創(chuàng)建自動化客戶端
1. 啟動 Microsoft Visual Studio .NET。在文件菜單上,單擊新建,然后單擊項(xiàng)目。從 Visual C# 項(xiàng)目類型中選擇 Windows 應(yīng)用程序。默認(rèn)情況下會創(chuàng)建 Form1。 
2. 添加對 Microsoft PowerPoint 對象庫和 Microsoft Graph 對象庫的引用。為此,請按照下列步驟操作: 
a.  在項(xiàng)目菜單上,單擊添加引用。 
b.  在 COM 選項(xiàng)卡上,找到 Microsoft PowerPoint 對象庫,然后單擊選擇。還應(yīng)找到 Microsoft Graph 對象庫,然后單擊選擇。
注意:Microsoft Office XP 不包含 PIA,但您可以下載 PIA。有關(guān) Office XP PIA 的其他信息,請單擊下面的文章編號,以查看 Microsoft 知識庫中相應(yīng)的文章: 

328912 INFO:Microsoft Office XP PIA 可供下載  
c.  在添加引用對話框中單擊確定以接受您的選擇。 
 
3. 在視圖菜單上,選擇工具箱以顯示工具箱,然后向 Form1 添加一個按鈕。 
4. 雙擊 Button1。將出現(xiàn)該窗體的代碼窗口。 
5. 在代碼窗口中,將以下代碼
private void button1_Click(object sender, System.EventArgs e){
}     替換為: 
private void button1_Click(object sender, System.EventArgs e){
 ShowPresentation(); GC.Collect();}
private void ShowPresentation(){
 String strTemplate, strPic; strTemplate =   "C:\\Program Files\\Microsoft Office\\Templates\\Presentation Designs\\Blends.pot"; strPic = "C:\\Windows\\Blue Lace 16.bmp"; bool bAssistantOn;
 PowerPoint.Application objApp; PowerPoint.Presentations objPresSet; PowerPoint._Presentation objPres; PowerPoint.Slides objSlides; PowerPoint._Slide objSlide; PowerPoint.TextRange objTextRng; PowerPoint.Shapes objShapes; PowerPoint.Shape objShape; PowerPoint.SlideShowWindows objSSWs; PowerPoint.SlideShowTransition objSST; PowerPoint.SlideShowSettings objSSS; PowerPoint.SlideRange objSldRng; Graph.Chart objChart;
 //Create a new presentation based on a template. objApp = new PowerPoint.Application(); objApp.Visible = MsoTriState.msoTrue; objPresSet = objApp.Presentations; objPres = objPresSet.Open(strTemplate,  MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue); objSlides = objPres.Slides;
 //Build Slide #1: //Add text to the slide, change the font and insert/position a //picture on the first slide. objSlide = objSlides.Add(1,PowerPoint.PpSlideLayout.ppLayoutTitleOnly); objTextRng = objSlide.Shapes[1].TextFrame.TextRange; objTextRng.Text = "My Sample Presentation"; objTextRng.Font.Name = "Comic Sans MS"; objTextRng.Font.Size = 48; objSlide.Shapes.AddPicture(strPic, MsoTriState.msoFalse, MsoTriState.msoTrue,  150, 150, 500, 350);
 //Build Slide #2: //Add text to the slide title, format the text. Also add a chart to the //slide and change the chart type to a 3D pie chart. objSlide = objSlides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly); objTextRng = objSlide.Shapes[1].TextFrame.TextRange; objTextRng.Text = "My Chart"; objTextRng.Font.Name = "Comic Sans MS"; objTextRng.Font.Size = 48; objChart = (Graph.Chart) objSlide.Shapes.AddOLEObject(150,150,480,320,  "MSGraph.Chart.8", "", MsoTriState.msoFalse, "", 0, "",  MsoTriState.msoFalse).OLEFormat.Object; objChart.ChartType = Graph.XlChartType.xl3DPie; objChart.Legend.Position=Graph.XlLegendPosition.xlLegendPositionBottom; objChart.HasTitle = true; objChart.ChartTitle.Text = "Here it is...";
 //Build Slide #3: //Change the background color of this slide only. Add a text effect to the slide //and apply various color schemes and shadows to the text effect. objSlide = objSlides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank); objSlide.FollowMasterBackground = MsoTriState.msoFalse; objShapes = objSlide.Shapes; objShape = objShapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect27,   "The End", "Impact", 96, MsoTriState.msoFalse, MsoTriState.msoFalse, 230, 200);
 //Modify the slide show transition settings for all 3 slides in //the presentation. int[] SlideIdx = new int[3]; for(int i=0;i<3;i++) SlideIdx[i]=i+1; objSldRng = objSlides.Range(SlideIdx); objSST = objSldRng.SlideShowTransition; objSST.AdvanceOnTime = MsoTriState.msoTrue; objSST.AdvanceTime = 3; objSST.EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut;
 //Prevent Office Assistant from displaying alert messages: bAssistantOn = objApp.Assistant.On; objApp.Assistant.On = false;
 //Run the Slide show from slides 1 thru 3. objSSS = objPres.SlideShowSettings; objSSS.StartingSlide = 1; objSSS.EndingSlide = 3; objSSS.Run();
 //Wait for the slide show to end. objSSWs = objApp.SlideShowWindows; while(objSSWs.Count>=1) System.Threading.Thread.Sleep(100);
 //Reenable Office Assisant, if it was on: if(bAssistantOn) {  objApp.Assistant.On = true;  objApp.Assistant.Visible = false; }
 //Close the presentation without saving changes and quit PowerPoint. objPres.Close(); objApp.Quit();}
     注意:在上述代碼中,sTemplate 和 sPic 常量分別表示 PowerPoint 模板和圖片的完整路徑及文件名。按照需要修改這些路徑以使用安裝在您系統(tǒng)中的模板或圖片。 
6. 滾動到代碼窗口的頂部。將下面的代碼行添加到 using 指令列表的末尾:
using Microsoft.Office.Core;using PowerPoint = Microsoft.Office.Interop.PowerPoint;using Graph = Microsoft.Office.Interop.Graph;using System.Runtime.InteropServices;      
7. 按 F5 鍵生成并運(yùn)行該程序。 
8. 在窗體中單擊 Button1 創(chuàng)建并顯示 PowerPoint 演示文稿。 

 返回頁首 

參考
有關(guān)更多信息,請?jiān)L問下面的 Microsoft Web 站點(diǎn): 

Microsoft Office Development with Visual Studio(使用 Visual Studio 進(jìn)行 Microsoft Office 開發(fā)) http://msdn.microsoft.com/library/en-us/dnoffdev/html/vsofficedev.asp
有關(guān) PowerPoint 自動化的其他信息,請單擊下面的文章編號,以查看 Microsoft 知識庫中相應(yīng)的文章: 

180616 HOWTUse MFC to Create and Show a PowerPoint Presentation 
222929 HOWTAutomate PowerPoint Using Visual Basic 
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
C#在調(diào)用office的PowerPoint時出現(xiàn) 對 COM 組件的調(diào)用返回了錯誤 HRESULT E
PPT導(dǎo)出為圖片
PasteSpecial方法
PowerPoint的VBA設(shè)計(jì)中Shape對象運(yùn)用方法初探
批量修改ppt中所有字的字體顏色
解決在PowerPoint 2007/2010中打字慢的問題
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服