[]
        
(Showing Draft Content)

IChartTitle

Interface IChartTitle

All Known Subinterfaces:
IAxisTitle

public interface IChartTitle
Represents the title of a chart.

An IChartTitle provides access to the title text and related formatting for a chart, including its text frame, font, layout participation, formula binding, text orientation, and text direction. Use IChart.getChartTitle() to obtain the title object for a chart.


 IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
 IChartTitle chartTitle = chart.getChartTitle();
 chartTitle.setText("Sales Analysis");
 String titleText = chartTitle.getText();
 
  • Method Details

    • getParent

      IChart getParent()
      Gets the parent IChart that contains this chart title.

      Use this method to access the chart that owns the current chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       IChart parentChart = title.getParent();
       
      Returns:
      The parent IChart of the chart title.
    • getText

      String getText()
      Gets the text of the chart title.

      Use this method to retrieve the text currently displayed in the chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       String text = title.getText();
       
      Returns:
      The text of the chart title.
    • setText

      void setText(String value)
      Sets the text of the chart title.

      Use this method to set or replace the text displayed in the chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       title.setText("Sample");
       
      Parameters:
      value - The text of the chart title.
    • getTextFrame

      ITextFrame getTextFrame()
      Gets the ITextFrame object that contains the text frame settings of the chart title.

      Use the returned ITextFrame object to access and modify the text content and layout settings of the chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       ITextFrame textFrame = title.getTextFrame();
       textFrame.getTextRange().setText("Quarterly Sales");
       
      Returns:
      The ITextFrame object for the chart title text.
    • getFont

      IFontFormat getFont()
      Gets the IFontFormat object for the chart title.

      Use the returned font format to read or modify font settings for the text displayed in the chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       IFontFormat font = title.getFont();
       font.getColor().setRGB(Color.GetBlue());
       
      Returns:
      The IFontFormat object for the chart title.
    • getFormat

      IChartFormat getFormat()
      Gets the chart format of the chart title.

      Use the returned IChartFormat object to access the fill and line formatting settings of the chart title.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       IChartFormat format = title.getFormat();
       format.getFill().getColor().setRGB(Color.GetBlue());
       
      Returns:
      The IChartFormat object that represents the chart title formatting.
    • getFormula

      String getFormula()
      Gets the formula of the chart title using A1-style notation, in English.

      Use this method to retrieve the formula string assigned through setFormula(String) when the chart title is linked to worksheet data.

      
       worksheet.getRange("E1").setValue("Sales Analysis");
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       chart.getChartTitle().setFormula("=Sheet1!$E$1");
       String formula = chart.getChartTitle().getFormula();
       
      Returns:
      The formula string of the chart title in A1-style notation, in English.
    • setFormula

      void setFormula(String value)
      Sets the formula of the chart title using A1-style notation, in English.
      
       worksheet.getRange("E1").setValue("Sales Analysis");
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       chart.getChartTitle().setFormula("=Sheet1!$E$1");
       
      Parameters:
      value - The formula string of the chart title in A1-style notation, in English.
    • getFormulaR1C1

      String getFormulaR1C1()
      Gets the formula of the chart title using R1C1-style notation, in English.

      Use this method to retrieve the formula string assigned through setFormulaR1C1(String) when the chart title is linked to worksheet data.

      
       worksheet.getRange("E1").setValue("Sales Analysis");
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       chart.getChartTitle().setFormulaR1C1("=Sheet1!R1C5");
       String formula = chart.getChartTitle().getFormulaR1C1();
       
      Returns:
      The formula string of the chart title in R1C1-style notation, in English. Returns null if no formula is assigned.
    • setFormulaR1C1

      void setFormulaR1C1(String value)
      Sets the formula of the chart title using R1C1-style notation, in English.
      
       worksheet.getRange("E1").setValue("Sales Analysis");
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       chart.getChartTitle().setFormulaR1C1("=Sheet1!R1C5");
       
      Parameters:
      value - The formula string of the chart title in R1C1-style notation, in English. Sets null if no formula is assigned.
    • getIncludeInLayout

      boolean getIncludeInLayout()
      Gets whether the chart title is included in the chart layout.

      If this property is true, the chart title occupies chart layout space when the chart layout is determined. The default value is true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       chart.getChartTitle().setIncludeInLayout(false);
       boolean includeInLayout = chart.getChartTitle().getIncludeInLayout();
       
      Returns:
      true if the chart title occupies chart layout space when the chart layout is determined; otherwise, false.
    • setIncludeInLayout

      void setIncludeInLayout(boolean value)
      Sets whether the chart title is included in the chart layout.

      If this property is true, the chart title occupies chart layout space when the chart layout is determined. The default value is true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       chart.getChartTitle().setIncludeInLayout(false);
       
      Parameters:
      value - true if the chart title occupies chart layout space when the chart layout is determined; otherwise, false.
    • getOrientation

      int getOrientation()
      Gets the text orientation of the chart title.

      The returned value is the rotation angle of the chart title text, in degrees.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       chart.getChartTitle().setOrientation(45);
       int orientation = chart.getChartTitle().getOrientation();
       
      Returns:
      The text orientation of the chart title, in degrees.
    • setOrientation

      void setOrientation(int value)
      Sets the text orientation of the chart title.

      Set this property to specify the rotation angle of the chart title text, in degrees.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       chart.getChartTitle().setOrientation(45);
       
      Parameters:
      value - The text orientation of the chart title, in degrees.
    • getDirection

      TextDirection getDirection()
      Gets the text direction of the chart title.

      Use this method to determine how the chart title text is oriented, such as horizontal, vertical, or rotated layout.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       chart.getChartTitle().setDirection(TextDirection.Vertical);
       TextDirection direction = chart.getChartTitle().getDirection();
       
      Returns:
      The TextDirection value that specifies the text direction of the chart title.
    • setDirection

      void setDirection(TextDirection value)
      Sets the text direction of the chart title.

      Use this method to control how the chart title text is displayed, such as horizontal, vertical, or rotated layout.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       title.setDirection(TextDirection.Vertical);
       
      Parameters:
      value - The TextDirection value to apply to the chart title text.
    • delete

      void delete()
      Deletes the chart title object.

      Use this method to remove the title from the chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][]{{"Month", "Sales"}, {"Jan", 12}, {"Feb", 18}, {"Mar", 15}});
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       chart.setHasTitle(true);
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       title.delete();