FlexPro Forum – Discuss Your Topic!

Automating JPEG export of charts

Home > Community > Automation and VBA > Automating JPEG export of charts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12874
    Michael HaagMichael Haag
    Member

    Dear Sir or Madam,

    I have tried to automate the JPEG export of embedded charts. The document containig the charts is about 30 pages long and the number of charts is about 40.

    In the HTML help I have found the following method:

    Ausdruck.Export(Format, PathName, Interactive, PageNumber)

    The arrays which contain the sheetnumber, the index of the chart and the Pathname are already definded.

    So, my question is how do I have to write the method so that it is possible to export all charts by means of a for loop?

    Specifically how is the appearance of the part “Ausdruck”? The part “Ausdruck” should contain expressions so that I can export each chart with the aid of a for loop.

    Is that possible?

    Yours sincerely

    Mike

    #8534
    Michael HaagMichael Haag
    Member

    Dear Sir or Madam,

    I have tried to automate the JPEG export of embedded charts. The document containig the charts is about 30 pages long and the number of charts is about 40.

    In the HTML help I have found the following method:

    Ausdruck.Export(Format, PathName, Interactive, PageNumber)

    The arrays which contain the sheetnumber, the index of the chart and the Pathname are already definded.

    So, my question is how do I have to write the method so that it is possible to export all charts by means of a for loop?

    Specifically how is the appearance of the part “Ausdruck”? The part “Ausdruck” should contain expressions so that I can export each chart with the aid of a for loop.

    Is that possible?

    Yours sincerely

    Mike

    #9380
    Bernhard KantzBernhard Kantz
    Participant

    The easiest way to get images of all pages of a document is to export it as a HTML pageset. This creates .png images for all pages that can be post-processed to cut out the portions for the individual charts. One remark: for synthetic pictures, the png format yields better results than jpeg, the latter is optimized for photographs of natural scenes.
    If you want to create single images from the charts, you have to loop over the pages of the document and for each page over the shapes. If the shapes DocObject is a Diagram2D (or Diagram3D) you can export it using the Export method mentioned in your posting.

    #9381
    Michael HaagMichael Haag
    Member

    Many thanks for the quick reply!

    Ok, I will consider your remark about the export format.Yes, the aim is to export all charts as a single image.

    Unfortunately, I will not have access to a machine having FlexPro Professional installed within the next 4 days.

    I must confess that I am a newbie in VBA programming, so I hope you can give me a hint regarding the follwing.

    In order to export each chart into a single image I have to use the export method:

    Ausdruck.Export(Format, PathName, Interactive, PageNumber)

    So, my problem is how to make the method export Diagram2D, index 4 on page 2?

    How is the syntax of “Ausdruck” in this case?

    #9382
    Bernhard KantzBernhard Kantz
    Participant

    The document consists of a collection of pages, each containing a collection of shapes. Some of them like tables and diagrams have DocObjects associated with. The following sample enumerates the diagrams of a document and displays their name.

    
    Sub DocuTest()
        Dim oDoc As Document
        Set oDoc = ThisDatabase.RootFolder("Dokument", fpObjectTypeDocument)
        
        Dim oShapes As Shapes
        For Each oShapes In oDoc.Pages
            Dim oShape As Shape
            For Each oShape In oShapes
                If Not oShape.DocObject Is Nothing Then
                    If oShape.DocObject.ObjectType = fpObjectType2DDiagram _
                    Or oShape.DocObject.ObjectType = fpObjectType3DDiagram Then
                        MsgBox oShape.DocObject.Name
                    End If
                End If
            Next
        Next
    End Sub
    
    
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.