????? ????? PowerPoint ???????? Visual J ++ 6.0

?????? ????????? ?????? ?????????
???? ???????: 215484 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

??????

???? ??? ??????? ????? ????? Microsoft PowerPoint ???????? Microsoft Visual J ++ 6.0. ????? ????? ????? ?????? ?????? ?????? ???????? ?????? ?????? ??????? Microsoft Office ??????.

??????? ????

???? ??????? ??????? ?????? ?????? Visual J ++ ???????.
  1. ??? ????? Visual J ++ 6.0. ????? ????? "????? ???? ????" ???? ?? ??? JavaPpt.
  2. ?? ???? ?????? ????????? ???? ???? Project ?? ???? ????? ??????? ??? ????? Class1.java ?????.
  3. ?? ??????? ??????? ???? ??? ????? ?????? COM ???? ??? ????? ?????? Microsoft PowerPoint 8.0 (?? 9.0 ?? PowerPoint 2000 ?? 10.0 ?? PowerPoint 2002.) ?? ???? ??? ?????. ???? ??? ??? ????? Wrappers COM Java ??????? ?? msppt8.olb ????? ??? PowerPoint ??? ???????. ???? ????? ????? PowerPoint 2000 msppt9.0lb. ????? ??????? ?? PowerPoint 2002 ?? msppt.olb.
  4. ?? ???? ????? Class1.Java ????? ?????? ????????? ???????:
    import msppt8.*; // PowerPoint support.  Use msppt9.* for 2000, and msppt.* for 2002
    import com.ms.com.*; // Variant & exception support. 
    import java.lang.InterruptedException; // Needed for Thread.sleep().
    						
  5. ?? ????? ?? ???? main() ?????? ???????? ???????? ???????:
    // Force COM objects to be created on the current thread.
    // Otherwise, older VMs might not release all references
    // and PowerPoint might continue to run after you shutdown.
    ComLib.declareMessagePumpThread();
    	
    // Launch PowerPoint.
    Application app = new Application();
    			
    // Add a presentation.
    Presentation pres = app.getPresentations().Add(1);
    
    // Add a slide with text layout.
    Slide slide1 = pres.getSlides().Add(1, PpSlideLayout.ppLayoutText);
    // Add text to slide.
    slide1.getShapes().Item(new Variant(1)).getTextFrame().getTextRange().setText("My first slide");
    	slide1.getShapes().Item(new Variant(2)).getTextFrame().getTextRange().setText("Automating PowerPoint is easy!\r\nUsing VJ++ is fun.");
    
    // Add another slide, but with text and chart.
    Slide slide2 = pres.getSlides().Add(2, PpSlideLayout.ppLayoutTextAndChart);
    // Add text to slide.
    slide2.getShapes().Item(new Variant(1)).getTextFrame().getTextRange().setText("Slide 2's topic");
    slide2.getShapes().Item(new Variant(2)).getTextFrame().getTextRange().setText("You can create and use charts in your PowerPoint slides!");
    
    // Add chart where default chart is.
    {
    	Variant index = new Variant(3);
    	float top = slide2.getShapes().Item(index).getTop();
    	float width = slide2.getShapes().Item(index).getWidth();
    	float height = slide2.getShapes().Item(index).getHeight();
    	float left = slide2.getShapes().Item(index).getLeft();
    	slide2.getShapes().AddOLEObject(left, top, width, height, "MSGraph.Chart", "", 0, "", 0, "", 0);
    	// Remove old/default chart.
    	slide2.getShapes().Item(index).Delete();
    }
    
    // Add another slide, but with text and org-chart.
    Slide slide3 = pres.getSlides().Add(3, PpSlideLayout.ppLayoutOrgchart);
    // Add title for this slide.
    slide3.getShapes().Item(new Variant(1)).getTextFrame().getTextRange().setText("The rest is only limited by your Imagination");
    // Add a new org chart where existing one is.
    {
    	Variant index = new Variant(2);
    	float top = slide3.getShapes().Item(index).getTop();
    	float width = slide3.getShapes().Item(index).getWidth();
    	float height = slide3.getShapes().Item(index).getHeight();
    	float left = slide3.getShapes().Item(index).getLeft();
    	slide3.getShapes().AddOLEObject(left, top, width, height, "OrgPlusWOPX.4", "", 0, "", 0, "", 0);
             // OrgPlusWOPX.4 is provided by the Microsoft Organization Chart application.
    	// Remove old/default org-chart.
    	slide3.getShapes().Item(index).Delete();		
    }
    	
    // Setup slide-show properties.
    {
    	Variant varOpt = new Variant();
    	varOpt.noParam();
    	SlideShowTransition sst;
    	sst = pres.getSlides().Range(varOpt).getSlideShowTransition();
    	sst.setEntryEffect(PpEntryEffect.ppEffectRandom);
    	sst.setAdvanceOnTime(1);
    	sst.setAdvanceTime(5); // 5 seconds per slide
    	sst = null;
    }
    {
    	SlideShowSettings sss;
    	sss = pres.getSlideShowSettings();
    	sss.setShowType(PpSlideShowType.ppShowTypeKiosk);
    	sss.setLoopUntilStopped(1);
    	sss.setRangeType(PpSlideShowRangeType.ppShowAll);
    	sss.setAdvanceMode(PpSlideShowAdvanceMode.ppSlideShowUseSlideTimings);
    	// Run slide show...
    	sss.Run();
    	sss = null;
    }
    
    // Sleep for a while so user can watch slide show.
    try {
    	Thread.sleep(15000);
    } catch(InterruptedException e) {}
    
    // Stop slide show.
    try {
    	pres.getSlideShowWindow().getView().Exit();
    } catch(ComFailException e) {}
    	
    // Clean up.
    pres.Close();
    app.Quit();
    slide3 = null;
    slide2 = null;
    slide1 = null;
    pres = null;
    app = null;
    						
  6. ?? ??????? "?????" ? ???? ??? ???? (?? ???? F5) ?????? ?????? ???????.

?????

?????? ??? ??????? ?????? ??? Visual J ++ ??????? ?????? ?????? ???????? ??????? ?? "????? ????? Microsoft:
INFO 169173: ????? ??? ????? ?? Visual J ++

???????

???? ???????: 215484 - ????? ??? ??????: 10/???? ??????/1435 - ??????: 4.4
????? ???
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft PowerPoint 97 Standard Edition
  • Microsoft Visual J++ 6.0 Standard Edition
????? ??????: 
kbnosurvey kbarchive kbmt kbautomation kbhowto KB215484 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????215484

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com