[Solved] How to draw a rectangle in a spreadsheet

Discuss the spreadsheet application

[Solved] How to draw a rectangle in a spreadsheet

Postby gutee » Wed Jan 09, 2019 9:34 am

I have a task to make data visible, and try to draw rectangle based on strings in spreadsheet.
one example is, source table looks like :
name, scope
model1, inst1
model2, inst1/inst2

Which document I can learn how to draw shapes into the spreadsheet based on my table. the required rectangle may look like :
________________
| module1 |
| __________ |
| | module2 | |
| |_________| |
|_______________|

Thanks in advance.
Last edited by Hagar Delest on Fri Jan 11, 2019 9:32 am, edited 1 time in total.
Reason: tagged solved
OpenOffice.org.3.3.0
gutee
 
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Re: How to draw a rectangle in a spreadsheet

Postby keme » Wed Jan 09, 2019 3:29 pm

Creating hierarchical framesets automatically may be possible by the use of conditional formatting.

Functionality depends on how deep you need to go, and how coherent/consistent your data is.

Not sure how good the visualization will be. Calc is not very well equipped for presentation design.

Your sig. says you are using version OOo 3.3.0. You may benefit from upgrading now. While I also stayed with 3.3 long after Apache took over, they have a stable and functional product now. Just a thought...
User avatar
keme
Volunteer
 
Posts: 3047
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: How to draw a rectangle in a spreadsheet

Postby John_Ha » Wed Jan 09, 2019 4:55 pm

You will find much useful information in the User Guides, the Writer, Base and Calc Tutorials and the AOO Frequently Asked Questions. May I suggest you bookmark the pages.

Why not just colour the cell backgrounds appropriately?
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Manual, the Writer FAQ, the Writer Tutorials and the Writer guide.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6350
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to draw a rectangle in a spreadsheet

Postby gutee » Wed Jan 09, 2019 5:37 pm

the hierarchical string list may be complex in my data, it should be more clear to show in the nested rectangles. but i still not find how to control shapes with the code in spreadsheet Macro.
OpenOffice.org.3.3.0
gutee
 
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Re: How to draw a rectangle in a spreadsheet

Postby gutee » Fri Jan 11, 2019 6:10 am

I found a simple solution to draw into the spreadsheet :

Code: Select all   Expand viewCollapse view
Sub test ()
Dim aPoint As New com.sun.star.awt.Point
Dim aSize As New com.sun.star.awt.Size
aPoint.x = 1000
aPoint.y = 1000
aSize.Width = 10000
aSize.Height = 10000
Dim oRectangleShape As Object
Dim oDocument As Object
Dim oPage As Object

oDocument = ThisComponent
oPage = oDocument.drawPages(3)

oRectangleShape = oDocument.createInstance("com.sun.star.drawing.RectangleShape")
oRectangleShape.Size = aSize
oRectangleShape.Position = aPoint
oRectangleShape.FillColor = RGB(255,110,110)
oPage.add(oRectangleShape)
Dim oEllipseShape As Object
oEllipseShape = oDocument.createInstance("com.sun.star.drawing.EllipseShape")
oEllipseShape.Position = aPoint
oEllipseShape.Size = aSize
oEllipseShape.FillColor = RGB(100,255,110)
oPage.add(oEllipseShape)
Dim oTextShape As Object
oTextShape = oDocument.createInstance("com.sun.star.drawing.TextShape")
aPoint.x = 11000
aPoint.y = 11000
oTextShape.Position = aPoint
oTextShape.Size=aSize
oPage.add(oTextShape)
oTextShape.String="Hello World"
End Sub
OpenOffice.org.3.3.0
gutee
 
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am


Return to Calc

Who is online

Users browsing this forum: Google [Bot] and 47 guests