本文整理汇总了Python中com.aspose.slides.Presentation.getSlides方法的典型用法代码示例。如果您正苦于以下问题:Python Presentation.getSlides方法的具体用法?Python Presentation.getSlides怎么用?Python Presentation.getSlides使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.aspose.slides.Presentation
的用法示例。
在下文中一共展示了Presentation.getSlides方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_custom_error_bar_value
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def add_custom_error_bar_value(dataDir):
dataDir = Settings.dataDir + "WorkingWithCharts/ErrorBars"
pres = Presentation()
slide = pres.getSlides().get_Item(0)
# Creating a bubble chart
chartType = ChartType
chart = pres.getSlides().get_Item(0).getShapes().addChart(chartType.Bubble, 50, 50, 400, 300, True)
# Adding custom Error bars and setting its format
error_bar_value_type = ErrorBarValueType
series = chart.getChartData().getSeries().get_Item(0)
error_bar_x = series.getErrorBarsXFormat()
error_bar_y = series.getErrorBarsYFormat()
# error_bar_x.isVisible(True)
# error_bar_y.isVisible(True)
error_bar_x.setValueType(error_bar_value_type.Custom)
error_bar_y.setValueType(error_bar_value_type.Custom)
# Accessing chart series data point and setting error bars values for individual point
data_source_type = DataSourceType
points = series.getDataPoints()
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForXPlusValues(
data_source_type.DoubleLiterals
)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForXMinusValues(
data_source_type.DoubleLiterals
)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForYPlusValues(
data_source_type.DoubleLiterals
)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForYMinusValues(
data_source_type.DoubleLiterals
)
# Setting error bars for chart series points
i = 0
while i < points.size():
points.get_Item(i).getErrorBarsCustomValues().getXMinus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getXPlus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getYMinus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getYPlus().setAsLiteralDouble(i + 1)
i += 1
save_format = SaveFormat
pres.save(dataDir + "ErrorBarsCustomValues.pptx", save_format.Pptx)
print "Added custom error bars values for chart, please check the output file."
示例2: remove_slide_by_id
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def remove_slide_by_id(dataDir):
dataDir = Settings.dataDir + 'WorkingWithSlidesInPresentation/RemoveSlides/'
# Instantiate Presentation class that represents the presentation file
pres = Presentation(dataDir + 'Aspose.pptx')
# Removing a slide using its slide index
pres.getSlides().removeAt(1)
# Saving the presentation file
save_format = SaveFormat
pres.save(dataDir + "Modified.pptx", save_format.Pptx)
print "Removed slide by ID, please check the output file."
示例3: set_image_as_background_color
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def set_image_as_background_color(dataDir):
dataDir = Settings.dataDir + 'WorkingWithSlidesInPresentation/Background/'
# Instantiate Presentation class that represents the presentation file
pres = Presentation()
# Set the background with Image
backgroundType = BackgroundType
fillType = FillType
pictureFillMode = PictureFillMode
pres.getSlides().get_Item(0).getBackground().setType(backgroundType.OwnBackground)
pres.getSlides().get_Item(0).getBackground().getFillFormat().setFillType(fillType.Picture)
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Stretch)
# Set the picture
imgx = pres.getImages().addImage(FileInputStream(File(dataDir + 'night.jpg')))
# Image imgx = pres.getImages().addImage(image)
# Add image to presentation's images collection
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)
# Saving the presentation
save_format = SaveFormat
pres.save(dataDir + "ContentBG_Image.pptx", save_format.Pptx)
print "Set image as background, please check the output file."
示例4: fill_shapes_with_solid_color
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def fill_shapes_with_solid_color(dataDir):
dataDir = Settings.dataDir + 'WorkingWithShapes/FillingShapes/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Add autoshape of rectangle type
shapeType = ShapeType
shp = sld.getShapes().addAutoShape(shapeType.Rectangle, 50, 150, 75, 150)
# Set the fill type to Solid
fillType = FillType
shp.getFillFormat().setFillType(fillType.Solid)
# Set the color of the rectangle
color = Color
shp.getFillFormat().getSolidFillColor().setColor(color.YELLOW)
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "RectShpSolid.pptx", save_format.Pptx)
print "Filled shapes with Solid Color, please check the output file."
示例5: fill_shapes_with_picture
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def fill_shapes_with_picture(dataDir):
dataDir = Settings.dataDir + 'WorkingWithShapes/FillingShapes/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Add autoshape of rectangle type
shapeType = ShapeType
shp = sld.getShapes().addAutoShape(shapeType.Rectangle, 50, 150, 75, 150)
# Set the fill type to Picture
fillType = FillType
shp.getFillFormat().setFillType(fillType.Picture)
# Set the picture fill mode
pictureFillMode = PictureFillMode
shp.getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Tile)
# Set the picture
imgx = pres.getImages().addImage(FileInputStream(File(dataDir + "night.jpg")))
shp.getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "RectShpPic.pptx", save_format.Pptx)
print "Filled shapes with Picture, please check the output file."
示例6: fill_shapes_with_pattern
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def fill_shapes_with_pattern(dataDir):
dataDir = Settings.dataDir + 'WorkingWithShapes/FillingShapes/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Add autoshape of rectangle type
shapeType = ShapeType
shp = sld.getShapes().addAutoShape(shapeType.Rectangle, 50, 150, 75, 150)
# Set the fill type to Pattern
fillType = FillType
shp.getFillFormat().setFillType(fillType.Pattern)
# Set the pattern style
patternStyle = PatternStyle
shp.getFillFormat().getPatternFormat().setPatternStyle(patternStyle.Trellis)
# Set the pattern back and fore colors
color = Color
shp.getFillFormat().getPatternFormat().getBackColor().setColor(color.LIGHT_GRAY)
shp.getFillFormat().getPatternFormat().getForeColor().setColor(color.YELLOW)
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "RectShpPatt.pptx", save_format.Pptx)
print "Filled shapes with Pattern, please check the output file."
示例7: __init__
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithSlidesInPresentation/AddSlides/'
# Instantiate Presentation class that represents the presentation file
pres =Presentation()
# Instantiate SlideCollection calss
slides = pres.getSlides()
i = 0
while i < pres.getLayoutSlides().size():
# Add an empty slide to the Slides collection
slides.addEmptySlide(pres.getLayoutSlides().get_Item(i))
i+=1
#Do some work on the newly added slide
# Saving the presentation
save_format = SaveFormat
pres.save(dataDir + "EmptySlide.pptx", save_format.Pptx)
print "Document has been created, please check the output file."
示例8: create_smartart_shape
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def create_smartart_shape(dataDir):
dataDir = Settings.dataDir + 'WorkingWithSmartArt/FillFormat/'
# Create an instance of Presentation class
pres =Presentation()
# Get the first slide
slide = pres.getSlides().get_Item(0)
# Adding SmartArt shape and nodes
smartArtLayoutType=SmartArtLayoutType
chevron = slide.getShapes().addSmartArt(10, 10, 800, 60, smartArtLayoutType.ClosedChevronProcess)
node = chevron.getAllNodes().addNode()
node.getTextFrame().setText("Some text")
# Setting node fill color
color=Color
fillType=FillType
item = node.getShapes().get_Item(0)
item.getFillFormat().setFillType(fillType.Solid)
item.getFillFormat().getSolidFillColor().setColor(color.RED)
# Write the presentation as a PPTX file
saveFormat=SaveFormat
pres.save(dataDir + "FillFormat.pptx", saveFormat.Pptx)
print "Set fill format for smartart node, please check the output file."
示例9: add_fixed_error_bar_value
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def add_fixed_error_bar_value(dataDir):
dataDir = Settings.dataDir + 'WorkingWithCharts/ErrorBars'
pres = Presentation()
# Creating a bubble chart
chartType=ChartType
chart = pres.getSlides().get_Item(0).getShapes().addChart(chartType.Bubble, 50, 50, 400, 300, True)
# Adding Error bars and setting its format
error_bar_x = chart.getChartData().getSeries().get_Item(0).getErrorBarsXFormat()
error_bar_y = chart.getChartData().getSeries().get_Item(0).getErrorBarsYFormat()
errorBarValueType = ErrorBarValueType
errorBarType = ErrorBarType
error_bar_x.setValueType(errorBarValueType.Fixed)
error_bar_x.setValue(0.1)
error_bar_y.setValueType(errorBarValueType.Percentage)
error_bar_y.setValue(5)
error_bar_x.setType(errorBarType.Plus)
error_bar_y.getFormat().getLine().setWidth(2.0)
#error_bar_x.hasEndCap(True)
# Save presentation with chart
save_format = SaveFormat
pres.save(dataDir + "ErrorBar.pptx", save_format.Pptx)
print "Added fixed error bar value for chart, please check the output file."
示例10: create_textbox_with_hyperlink
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def create_textbox_with_hyperlink(dataDir):
dataDir = Settings.dataDir + 'WorkingWithText/CreateTextBox/'
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Add autoshape of rectangle type
shapeType=ShapeType
pptxShape = sld.getShapes().addAutoShape(shapeType.Rectangle, 150, 150, 150, 50)
# Cast the shape to AutoShape
pptxAutoShape = pptxShape
# Access ITextFrame associated with the AutoShape
pptxAutoShape.addTextFrame("")
text_frame = pptxAutoShape.getTextFrame()
# Add some text to the frame
text_frame.getParagraphs().get_Item(0).getPortions().get_Item(0).setText("Aspose.Slides")
#Set Hyperlink for the portion text
hypman = text_frame.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getHyperlinkManager()
hypman.setExternalHyperlinkClick("http://www.aspose.com")
# Write the presentation as a PPTX file
save_format =SaveFormat
pres.save(dataDir + "hLinkPPTX.pptx", save_format.Pptx)
print "Created TextBox with Hyperlink, please check the output file."
示例11: add_audio_frame
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def add_audio_frame(dataDir):
dataDir = Settings.dataDir + 'WorkingWithShapes/Frame/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sId = pres.getSlides().get_Item(0)
# Load the wav sound file to stram
fstr = FileInputStream(File(dataDir + "Bass-Drum.wav"))
# Add Audio Frame
af = sId.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr)
# Set Play Mode and Volume of the Audio
audioPlayModePreset = AudioPlayModePreset
audioVolumeMode = AudioVolumeMode
af.setPlayMode(audioPlayModePreset.Auto)
af.setVolume(audioVolumeMode.Loud)
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "AudioFrameEmbed.pptx", save_format.Pptx)
print "Added audio frame to slide, please check the output file."
示例12: create_textbox
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def create_textbox(dataDir):
dataDir = Settings.dataDir + 'WorkingWithText/CreateTextBox/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Add autoshape of rectangle type
shapeType=ShapeType
shp = sld.getShapes().addAutoShape(shapeType.Rectangle, 150, 75, 150, 50)
# Add TextFrame to the Rectangle
shp.addTextFrame(" ")
# Accessing the text frame
txt_frame = shp.getTextFrame()
# Create the Paragraph object for text frame
para = txt_frame.getParagraphs().get_Item(0)
# Create Portion object for paragraph
portion = para.getPortions().get_Item(0)
# Set Text
portion.setText("Aspose TextBox")
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "TextBox.pptx", save_format.Pptx)
print "Created TextBox, please check the output file."
示例13: __init__
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithTables/AddImage/'
pres = Presentation()
# Get the first slide
sld = pres.getSlides().get_Item(0)
# Define co lumns with widths and rows with heights
dbl_cols = [150,150,150,150]
dbl_rows = [100,100,100,100,90]
# Add table shape to slide
tbl = sld.getShapes().addTable(50, 50, dbl_cols, dbl_rows)
# Creating a Buffered Image object to hold the image file
imageIO = ImageIO()
image = imageIO.read(File(dataDir + "aspose-logo.jpg"))
imgx1 = pres.getImages().addImage(image)
fillType=FillType()
pictureFillMode=PictureFillMode()
tbl.get_Item(0,0).getFillFormat().setFillType(fillType.Picture)
tbl.get_Item(0,0).getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Stretch)
tbl.get_Item(0,0).getFillFormat().getPictureFillFormat().getPicture().setImage(imgx1)
# Write the presentation as a PPTX file
save_format = SaveFormat()
pres.save(dataDir + "AddImage.pptx", save_format.Pptx)
print "Added image, please check the output file."
示例14: create_thumbnail_custom_size
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def create_thumbnail_custom_size(dataDir):
# Instantiate Presentation class that represents the presentation file
pres = Presentation(dataDir + 'demo.pptx')
# Access the first slide
slide = pres.getSlides().get_Item(0)
# User defined dimension
desired_x = 1200
desired_y = 800
# Getting scaled value of X and Y
scale_x = (1.0 / java_values(pres.getSlideSize().getSize().getWidth())) * desired_x
scale_y = (1.0 / java_values(pres.getSlideSize().getSize().getHeight())) * desired_y
# Create a full scale image
image = slide.getThumbnail(scale_x, scale_y)
# Save the image to disk in JPEG format
imageIO = ImageIO()
imageIO.write(image, "jpeg", File(dataDir + "ContentBG_tnail.jpg"))
print "Created thumbnail with custom size, please check the output file.". PHP_EOL
示例15: add_video_frame
# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getSlides [as 别名]
def add_video_frame(dataDir):
dataDir = Settings.dataDir + 'WorkingWithShapes/Frame/'
# Create an instance of Presentation class
pres = Presentation()
# Get the first slide
sId = pres.getSlides().get_Item(0)
# Add Video Frame
vf = sId.getShapes().addVideoFrame(50, 150, 300, 150, dataDir + "Wildlife.mp4")
# Set Play Mode and Volume of the Video
videoPlayModePreset = VideoPlayModePreset
audioVolumeMode = AudioVolumeMode
vf.setPlayMode(videoPlayModePreset.Auto)
vf.setVolume(audioVolumeMode.Loud)
# Write the presentation as a PPTX file
save_format = SaveFormat
pres.save(dataDir + "VideoFrame.pptx", save_format.Pptx)
print "Added video frame to slide, please check the output file."