austgl / ooofbtools

Automatically exported from code.google.com/p/ooofbtools
0 stars 0 forks source link

Ошибка при попытке обработать картинку #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Скрипт конвертера останавливается с 
ошибкой отсутствия объекта на строке 318 (в 
процитированном фрагменте кода третья 
снизу, "oGraphic = oContent.ReplacementGraphic"):
Версия: OpenOffie.org 2.0.4

Я так полагаю, что конвертер уже не 
работает с OOo 2.x ...

' экспорт картинки в файл
Sub ExportGraphicToFile( oContent As Object, sFileNameURL As String, ByVal sExt 
As String )
    Dim sFileExt As String : sFileExt = sExt
    Dim oGP As Object, oGraphic As Object
    Dim args(3) As New com.sun.star.beans.PropertyValue
    oGP = createUnoService("com.sun.star.graphic.GraphicProvider")   

    If oContent.ShapeType = "com.sun.star.drawing.GraphicObjectShape" Then
        If InStr( oContent.GraphicUrl, "file:/" ) = 0 Then ' нет полного URL
            ' Картинка "встроена" в файл:
            ' oContent.GraphicUrl="vnd.sun.star.GraphicObject:...". Данные находятся в oContent.Graphic
            oGraphic = oContent.Graphic
        ElseIf InStr( oContent.GraphicUrl, "http:/" ) > 0 Or InStr( oContent.GraphicUrl, "ftp:/" ) > 0 Or _
                    InStr( oContent.GraphicUrl, "https:/" ) > 0 Then ' полный URL - указатель на сайт
            ' oContent.GraphicUrl="http:///...." или oContent.GraphicUrl="ftp:///....". oContent.Graphic = Null
            ' ничего не делаем - до картинки "не добраться"
        End If
    Else
        If oContent.ImplementationName = "SwXTextGraphicObject" Then ' Картинки 
            If InStr( oContent.GraphicUrl, "file:/" ) = 0 Then ' нет полного URL
                ' Картинка "встроена" в файл:
                ' oContent.GraphicUrl="vnd.sun.star.GraphicObject:...". Данные находятся в oContent.Graphic
                oGraphic = oContent.Graphic
            ElseIf InStr( oContent.GraphicUrl, "http:/" ) > 0 Or InStr( oContent.GraphicUrl, "ftp:/" ) > 0 Or _
                    InStr( oContent.GraphicUrl, "https:/" ) > 0 Then ' полный URL - указатель на сайт
                ' oContent.GraphicUrl="http:///...." или oContent.GraphicUrl="ftp:///....". oContent.Graphic = Null
                ' ничего не делаем - до картинки "не добраться"
            End If
        Else ' oContent.ImplementationName = "SwXTextEmbeddedObject" : OLE (Диаграммы) или Formula:
            ' oContent.GraphicUrl отсутствует. oContent.Graphic отсутствует. Данные находятся в oContent.ReplacementGraphic.
            oGraphic = oContent.ReplacementGraphic
        End If
    End If

Original issue reported on code.google.com by stas.gru...@gmail.com on 1 Feb 2011 at 6:18

GoogleCodeExporter commented 9 years ago
Не могли бы вы прислать мне на мой эмэйл 
(есть в окне О Программе OooFBTools) файл с 
картинкой - хочу прогнать под отладчиком...

Насчет версий OOo - разработчики OOo так часто 
меняют "нутро" офиса, что я уже и не знаю - 
что на какой версии OOo и работает. По 
крайней мере на последней версии OOo 
работает точно.
Но - возможно у вас картинка в файле, тип 
которой не отлавливается конвертером. Так 
что мне в любом случае потребуется ваш файл.

Original comment by dik...@gmail.com on 2 Apr 2011 at 7:30