[Libreoffice-bugs] [Bug 144191] New: LILO starbase macro give name to chart proved by xraytool but manually the chart name is empty string

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Aug 30 15:53:24 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=144191

            Bug ID: 144191
           Summary: LILO starbase macro give name to chart proved by
                    xraytool but manually the chart name is empty string
           Product: LibreOffice
           Version: 7.3.0.0 alpha0+ Master
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Chart
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: elias_0000_0000 at yahoo.com

Created attachment 174646
  --> https://bugs.documentfoundation.org/attachment.cgi?id=174646&action=edit
calc file with macro code - chart name is empty even it is declared

LILO starbase macro give name to chart proved by xraytool but manually the
chart name is empty string

To reproduce: 
- Run the macro code in the attachment .ods file. 
- Check Chart Name property - an empty string
- Try manually to name the chart with the name defined in macro code 
- The"OK" button is grayed out.
- Try to set any other name. You can. 


- LILO starbase macro code (included in a cell in the attachment)

  Sub LoadingLibraries
   BasicLibraries.LoadLibrary("XrayTool")
  End Sub


  Sub CreateCalcWithSimpleChart

  ' Definitions of variables
  Dim oSheet    'Sheet containing the chart
  Dim oRect     'How big is the chart
  Dim oCharts   'Charts in the sheet
  Dim oChart    'Created chart
  Dim oAddress  'Address of data to plot
  Dim sName$    'Chart name
  Dim oChartDoc 'Embedded chart object
  Dim oTitle    'Chart title object 
  Dim oDiagram  'Inserted diagram (data).
  Dim sDataRng  'Where is the data
  Dim oCalcDoc  

  ' it is needed to define Point and Size in order to
  ' change Position and Size of Chart Objects
  Dim Pos_Chart       As New com.sun.star.awt.Point
  Dim Pos_Title       As New com.sun.star.awt.Point
  Dim Pos_SubTitle    As New com.sun.star.awt.Point
  Dim Pos_xTitle      As New com.sun.star.awt.Point
  Dim Pos_yTitle      As New com.sun.star.awt.Point
  Dim Pos_Legend      As New com.sun.star.awt.Point

  Dim Size_Chart      As New com.sun.star.awt.Size
  Dim Size_Title      As New com.sun.star.awt.Size
  Dim Size_SubTitle   As New com.sun.star.awt.Size
  Dim Size_xTitle     As New com.sun.star.awt.Size
  Dim Size_yTitle     As New com.sun.star.awt.Size
  Dim Size_Legend     As New com.sun.star.awt.Size



  'Dont Forget to Define "Name of Sheet
  oSheets     = ThisComponent.getSheets()
  oSheet      = oSheets.getbyName( "Graph_stat" ) 


          Chart_XPos       = 0
          Chart_YPos       = 17000
          Chart_Width      = 16000
          Chart_Height     = 10000
                Chart_New_XPos   =  Chart_New_XPos + Chart_Width + 900

                'Creation of objects into variables
                oCalcDoc    = CreateCalcForChart()
                sName       = "stat1"
                sDataRng    = "D17:F28"
                oAddress    =
oSheet.getCellRangeByName(sDataRng).getRangeAddress()
                oCharts     = oSheet.getCharts()
                oRange      = oSheet.getCellRangeByName( sDataRng )


                'The size of the whole chart 
                If NOT oCharts.hasByName(sName) Then
                oRect       = createObject("com.sun.star.awt.Rectangle")
                oRect.X     = Chart_New_XPos
                oRect.Y     = Chart_YPos
                oRect.width = Chart_Width
                oRect.Height= Chart_Height

                oCharts.addNewByName(sName, oRect, Array(oAddress), True, True)
                End If          


                ' Getting the Chart for manipulations
                oChart       = oCharts.getByName(sName)  
                oChart.setRanges(Array(oAddress))
                oChartDoc    = oChart.getEmbeddedObject()
                oDiagram     =
oChartDoc.createInstance("com.sun.star.chart.ChartDiagram")
                oChartDoc.setDiagram(oDiagram)  
                oDiagram     = oChartDoc.getDiagram()


                'Inside the Chart, Setting Position and Size of the Diagram
                oChartDoc.RefreshAddInAllowed = True
                Pos_Chart.X                   = 300
                Pos_Chart.Y                   = 1200
                Size_Chart.width              = Chart_Width  - 800
                Size_Chart.height             = Chart_Height - 1500
                oDiagram.setPosition( Pos_Chart )
                oDiagram.setSize(     Size_Chart )


  end sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210830/2defb7ab/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list