Difference between revisions of "Documentation/DevGuide/Charts/How to Apply an Add-In to a Chart Document"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (1 revision(s))
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
|ShowPrevNext=block
 
|ShowPrevNext=block
 
|PrevPage=Documentation/DevGuide/Charts/How Add-Ins Work
 
|PrevPage=Documentation/DevGuide/Charts/How Add-Ins Work
|NextPage=Documentation/DevGuide/Basic/OpenOffice.org Basic and Dialogs
+
|NextPage=Documentation/DevGuide/Basic/OpenOffice.org Basic
 
}}
 
}}
{{DISPLAYTITLE:How to Apply an Add-In to a Chart Document}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Charts/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:How to Apply an Add-In to a Chart Document}}
 
There is no method to set an add-in as a chart type for an existing chart in the graphical user interface. To set the chart type, use an API script, for instance, in {{PRODUCTNAME}} Basic. The following example sets the add-in with service name “<code>com.sun.star.comp.Chart.JavaSampleChartAddIn</code>” at the current document. To avoid problems, it is advisable to create a chart that has the same type as the one that the add-in sets as <code>BaseDiagram</code> type.
 
There is no method to set an add-in as a chart type for an existing chart in the graphical user interface. To set the chart type, use an API script, for instance, in {{PRODUCTNAME}} Basic. The following example sets the add-in with service name “<code>com.sun.star.comp.Chart.JavaSampleChartAddIn</code>” at the current document. To avoid problems, it is advisable to create a chart that has the same type as the one that the add-in sets as <code>BaseDiagram</code> type.
 
+
<source lang="oobas">
 
   Sub SetAddIn
 
   Sub SetAddIn
 
   Dim oDoc As Object
 
   Dim oDoc As Object
Line 33: Line 34:
 
       End If
 
       End If
 
   End Sub
 
   End Sub
 
+
</source>
{{Documentation/Tip|If you want to create an XML-File on your own and want to activate your add-in for a chart; set the attribute <tt>chart:class</tt> of the <tt>chart:chart</tt> element to “add-in” and the attribute <tt>chart:add-in-name</tt> to the service name that uniquely identifies your component.}}
+
{{Tip|If you want to create an XML-File on your own and want to activate your add-in for a chart; set the attribute <tt>chart:class</tt> of the <tt>chart:chart</tt> element to “add-in” and the attribute <tt>chart:add-in-name</tt> to the service name that uniquely identifies your component.}}
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Charts]]
+
 
 +
[[Category:Documentation/Developer's Guide/Charts]]

Revision as of 19:53, 14 July 2018



There is no method to set an add-in as a chart type for an existing chart in the graphical user interface. To set the chart type, use an API script, for instance, in OpenOffice.org Basic. The following example sets the add-in with service name “com.sun.star.comp.Chart.JavaSampleChartAddIn” at the current document. To avoid problems, it is advisable to create a chart that has the same type as the one that the add-in sets as BaseDiagram type.

  Sub SetAddIn
  Dim oDoc As Object
  Dim oSheet As Object
  Dim oTableChart As Object
  Dim oChart As Object
  Dim oAddIn As Object
 
      ' assume that the current document is a spreadsheet
      oDoc = ThisComponent
      oSheet = oDoc.Sheets( 0 )
 
      ' assume also that you already added a chart
      ' named "MyChart" on the first sheet
      oTableChart = oSheet.Charts.getByName( "MyChart" )
 
      If Not IsNull( oTableChart ) Then
          oChart = oTableChart.EmbeddedObject
          If Not IsNull( oChart ) Then
              oAddIn = oChart.createInstance( "com.sun.star.comp.Chart.JavaSampleChartAddIn" )
              If Not IsNull( oAddIn ) Then
                  oChart.setDiagram( oAddIn )
              End If
          End If
      End If
  End Sub
Tip.png If you want to create an XML-File on your own and want to activate your add-in for a chart; set the attribute chart:class of the chart:chart element to “add-in” and the attribute chart:add-in-name to the service name that uniquely identifies your component.


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages