[Solved] First column as caption in VB.net

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] First column as caption in VB.net

Postby keosge » Sat Dec 15, 2012 1:14 am

Hi,
i use VB.net to insert and format a chart in an Open Office Calc file, then i need to set the first column as caption. I don't know how to try.

this is my code
Code: Select all   Expand viewCollapse view
        Dim Charts As Object
        Dim Chart As Object
        Dim Rect As Object
        Dim RangeAddress(7) As Object



        RangeAddress(0) = oSM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
        RangeAddress(0).Sheet = 0
        RangeAddress(0).StartColumn = 0
        RangeAddress(0).StartRow = 3
        RangeAddress(0).EndColumn = 0
        RangeAddress(0).EndRow = 13
        Dim i As Integer
        For i = 1 To 7
            RangeAddress(i) = oSM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
            RangeAddress(i).Sheet = 0
            RangeAddress(i).StartColumn = i * 3 + 1
            RangeAddress(i).StartRow = 3
            RangeAddress(i).EndColumn = i * 3 + 1
            RangeAddress(i).EndRow = 13
        Next i
        '        RangeAddress(0) = oSM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
        Rect = oSM.Bridge_GetStruct("com.sun.star.awt.Rectangle")
        Charts = os.charts
        Rect.X = 0
        Rect.Y = 7000
        Rect.Width = 34000
        Rect.Height = 9000


        Charts.addNewByName("MyChart", Rect, RangeAddress, False, False)
        Chart = Charts.getByName("MyChart").EmbeddedObject
        Chart.Diagram.Dim3D = True
        Chart.diagram.SolidType = 1
        Chart.diagram.deep = True


this is the layout i want
screencaptcorrect.jpg

this is what i have now
screencaptwrong.jpg

can some body help me?

thank a lot
Last edited by keosge on Sat Dec 15, 2012 1:37 pm, edited 1 time in total.
OpenOffice 3.4 on Win7
keosge
 
Posts: 5
Joined: Fri Dec 14, 2012 12:50 am

Re: First column as caption in VB.net

Postby Charlie Young » Sat Dec 15, 2012 4:16 am

The last two boolean parameters of addNewByName specify whether or not to use the first row and/or column of the data as labels, and you have these set to false.

If that isn't the problem, I realize you can't post the file with the charts because it's too big, but if you could post one with just the data, we could probably work with that and your code.
Apache OpenOffice 4.1.1
Windows XP
User avatar
Charlie Young
Volunteer
 
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: First column as caption in VB.net

Postby keosge » Sat Dec 15, 2012 1:37 pm

Thank a lot....

this forum is excellent two solution in half day.
OpenOffice 3.4 on Win7
keosge
 
Posts: 5
Joined: Fri Dec 14, 2012 12:50 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests