powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / PowerPoint
1 сообщений из 1, страница 1 из 1
PowerPoint
    #38175008
TataS
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Очень нужна помощь в решении следующей проблемы:
Необходимо из ASP.NET работать с PowerPoint. Библиотеки PowerPoint и Graph подключены.
Использую скаченный из инета пример:

Imports Microsoft.Office.Core
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.PowerPoint
Imports Microsoft.Office.Interop.Graph
Imports Microsoft.Office.Interop

Partial Class Test_PowerPoint
Inherits System.Web.UI.Page

Public PowerPoint As Microsoft.Office.Interop.PowerPoint.Application
Public Graph As Microsoft.Office.Interop.Graph.Application

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Call ShowPresentation()
GC.Collect()
End Sub

Sub ShowPresentation()
Dim strTemplate As String = "C:\Program Files\Microsoft Office\Templates\Presentation Designs\Blends.pot"
Dim strPic As String = "C:\Windows\Blue Lace 16.bmp"
Dim bAssistantOn As Boolean

Dim objApp As PowerPoint.Application
Dim objPressSet As PowerPoint.Presentations
Dim objPres As PowerPoint._Presentation
Dim objSlides As PowerPoint.Slides
Dim objSlide As PowerPoint._Slide
Dim objTextRng As PowerPoint.TextRange
Dim objShapes As PowerPoint.Shapes
Dim objShape As PowerPoint.Shape
Dim objSSWs As PowerPoint.SlideShowWindows
Dim objSST As PowerPoint.SlideShowTransition
Dim objSSS As PowerPoint.SlideShowSettings
Dim objSldRng As PowerPoint.SlideRange
Dim objChart As Graph.Chart

' Create a new presentation based on a template.
objApp = New PowerPoint.Application()
objApp.Visible = MsoTriState.msoTrue

objPressSet = objApp.Presentations
objPres = objPressSet.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, objApp.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)
. . .

Но вот на выделенной строке выдается ошибка: "Object variable or With block variable not set."
Почему-то в objApp отсутствует PpSlideLayout.
Как быть?
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / PowerPoint
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]