Difference between revisions of "Chart2/ChangeTitleFormattingForAllChartsInACalc"
From Apache OpenOffice Wiki
< Chart2
m |
m |
||
Line 4: | Line 4: | ||
| Programming Language: || StarBasic | | Programming Language: || StarBasic | ||
|+ | |+ | ||
− | | Author: | | + | | Author: || Ingrid Halama, 2008 |
|} | |} | ||
− | < | + | <syntaxhighlight lang="oobas"> |
Sub Main | Sub Main | ||
changeAllChartsInCalc() | changeAllChartsInCalc() | ||
Line 54: | Line 54: | ||
oChartModel.unlockControllers | oChartModel.unlockControllers | ||
end sub | end sub | ||
− | </ | + | </syntaxhighlight> |
[[Category:API]] | [[Category:API]] | ||
[[Category:Samples]] | [[Category:Samples]] | ||
[[Category:StarBasic]] | [[Category:StarBasic]] | ||
[[Category:Chart]] | [[Category:Chart]] |
Latest revision as of 17:08, 30 January 2021
Description: | Iterate over all charts in a spreadsheet document, insert a title and do some formatting at the title. | Programming Language: | StarBasic | Author: | Ingrid Halama, 2008 |
Sub Main changeAllChartsInCalc() End Sub sub changeAllChartsInCalc() 'iterate over all charts in a calc document dim oSheet as object dim oCharts as object SheetCount=ThisComponent.Sheets.getCount SheetNo=0 while( SheetNo<SheetCount ) oSheet=ThisComponent.Sheets(SheetNo) oCharts=oSheet.Charts ChartCount=oCharts.getCount ChartNo=0 while(ChartNo<ChartCount) dim oChartModel as object oChartModel = oCharts(ChartNo).EmbeddedObject changeOneChart( oChartModel ) ChartNo=ChartNo+1 wend SheetNo=SheetNo+1 wend end sub sub changeOneChart( oChartModel as object ) 'prevent change notifications to optimize performance oChartModel.lockControllers ' insert a main title and set some properties oChartModel.HasMainTitle = True oChartModel.Title.String = "Example Title" 'modify font and size oChartModel.Title.CharFontName = "Times New Roman" oChartModel.Title.CharHeight = 14 'modify color 'light gray 20% for the text for example oChartModel.Title.CharColor = RGB(204,204,204) 'some blue color 'chart12' for the backround oChartModel.Title.FillStyle = com.sun.star.drawing.FillStyle.SOLID oChartModel.Title.FillColor = RGB(00,132,209) 'add thin black lines around oChartModel.Title.LineStyle = com.sun.star.drawing.LineStyle.SOLID oChartModel.Title.LineColor = 0 'allow change notifications again thus the chart view gets updated when necessary oChartModel.unlockControllers end sub