Forum FlexPro – Discuss your topic!

Copying markers from a diagram to a document

Home > Community > Automation and VBA > Copying markers from a diagram to a document

Ansicht von 3 Beiträgen - 1 bis 3 (von insgesamt 3)
  • Autor
    Beiträge
  • #12446
    Krista TweedKrista Tweed
    Mitglied

    I am writting a VBA application that needs to copy the Markers text from a 2D-Diagram to the 2D-Diagram included in a Document.

    I have a 2D-Diagram with two curves and a Document which contains a copy of the 2D-Diagram. I set several markers in the 2D-Diagram and then I run my macro to copy only some of the markers into the document.

    The macro is able to copy the markers with X and Y coordinates but is unable to change the text of the marker.

    Here is a part of the macro :
    ——————————————
    Dim Diagramme As Diagram2D
    Dim Doc As Document
    Dim NbMarkers As Integer

    ‘Activate 2D-Diagram object
    ActiveDatabase.RootFolder.Object (“2D-Diagram.2D”)
    Set Diagramme = ActiveDatabase.ActiveObject

    ‘get NbMarkers in the 2D-Diagram object
    NbMarkers = ActiveDatabase.ActiveObject.Markers.Count

    ‘Activate the Document Object
    Windows(“CalculsDocument (Document)”).Activate

    ‘Activate the 2D-Diagram object in the document
    ActiveDatabase.ActiveObject.Pages(1).Item(1).Select

    Set Doc = ActiveDatabase.ActiveObject

    ‘Active cursors
    Doc.CursorActive = True

    ‘Autocenter Off
    Doc.ActiveCursor.Bounded = False

    ‘Place cursorX and cursorY in the document
    Doc.ActiveCursor.PositionX = TabMarker(i, 0)
    Doc.ActiveCursor.PositionY = TabMarker(i, 1)

    ‘Place marker in the document
    Doc.ActiveCursor.PlaceMarker

    ‘Change the marker text
    ActiveDatabase.ActiveObject.Markers.Item(1).Text=”O1″

    —————————————————————————-

    The last line ActiveDatabase.ActiveObject.Markers.Item(1).Text=”O1″ changes the marker text in the “2D-Diagram” but not in the document .

    Is it possible to change the text of the markers only in the document and not in the original 2D-Diagram ?

    #8741
    Bernhard KantzBernhard Kantz
    Teilnehmer

    To understand this problem, you need to know that, when a diagram is linked to different locations (document and/or worksheets), the markers are stored individually for each location.
    If you link a diagram to a document, then the document is storing the markers for the linked diagram along with other attributes like the individual horizontal and vertical dimensions of the linked diagram for example.

    As far as we investigated the problem, there seems to be no solution for it currently. The reason for that is that the marker text in a linked diagram in a document is addressable only while the diagram is inplace active, which means it is displayed with a dashed border inside the document. Unfortunately, the Automation Object Model for FlexPro is missing a method to inplace-activate an object.

    An alternative solution would be to address the markers through the CursorObject interface. When you change the marker text, then the marker closest to the active cursor in the active item (linked diagram) of the active CursorObject (Document) is changed. But the Object Model is also missing a method to address the active item in a CursorObject.

    We will further investigate on this problem and extend the object model so that it will be possible to perforem the requested operation.

    support@weisang.com

    #8127
    Krista TweedKrista Tweed
    Mitglied

    I am writting a VBA application that needs to copy the Markers text from a 2D-Diagram to the 2D-Diagram included in a Document.

    I have a 2D-Diagram with two curves and a Document which contains a copy of the 2D-Diagram. I set several markers in the 2D-Diagram and then I run my macro to copy only some of the markers into the document.

    The macro is able to copy the markers with X and Y coordinates but is unable to change the text of the marker.

    Here is a part of the macro :
    ——————————————
    Dim Diagramme As Diagram2D
    Dim Doc As Document
    Dim NbMarkers As Integer

    ‘Activate 2D-Diagram object
    ActiveDatabase.RootFolder.Object (“2D-Diagram.2D”)
    Set Diagramme = ActiveDatabase.ActiveObject

    ‘get NbMarkers in the 2D-Diagram object
    NbMarkers = ActiveDatabase.ActiveObject.Markers.Count

    ‘Activate the Document Object
    Windows(“CalculsDocument (Document)”).Activate

    ‘Activate the 2D-Diagram object in the document
    ActiveDatabase.ActiveObject.Pages(1).Item(1).Select

    Set Doc = ActiveDatabase.ActiveObject

    ‘Active cursors
    Doc.CursorActive = True

    ‘Autocenter Off
    Doc.ActiveCursor.Bounded = False

    ‘Place cursorX and cursorY in the document
    Doc.ActiveCursor.PositionX = TabMarker(i, 0)
    Doc.ActiveCursor.PositionY = TabMarker(i, 1)

    ‘Place marker in the document
    Doc.ActiveCursor.PlaceMarker

    ‘Change the marker text
    ActiveDatabase.ActiveObject.Markers.Item(1).Text=”O1″

    —————————————————————————-

    The last line ActiveDatabase.ActiveObject.Markers.Item(1).Text=”O1″ changes the marker text in the “2D-Diagram” but not in the document .

    Is it possible to change the text of the markers only in the document and not in the original 2D-Diagram ?

Ansicht von 3 Beiträgen - 1 bis 3 (von insgesamt 3)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.