Oh, sorry, it's not my intention to annoy anyone, nor to claim that Basic is "bad". On the contrary, I'm glad to have opportunities in basic to go ahead.
Admittedly I'm not an expert user as you surely are, but I'm doing my best to understand. When I'm asking, it's just to get a better understanding or to know if there might be a bug.
I understand that out of my scatterred code snippets it's hard to reproduce, so I compiled a snippet you can execute more easily.
Here we go
Code: Select all
Sub test_RGB
Dim mPoint As New com.sun.star.awt.Point
Dim mSize As New com.sun.star.awt.Size
Dim myBLACK__ As Long, myGREY__ As Long, myRED__ As Long, myWHITE__ As Long
Dim myBLUE__ As Long, myLIMEGREEN__ As Long, myYELLOW__ As Long, myBROWN__ As Long
Dim myMAGENTA__ As Long, myLIGHTGREY__ As Long
Dim oWriteDoc ' Newly created Write document to contain the names.
Dim oText ' Document text object.
Dim s : s = "private:factory/swriter"
'oWriteDoc = StarDesktop.loadComponentFromURL(s, "_blank", 0, Array())
'oText = oWriteDoc.getText()
'oText.insertString ( oText.End, "myBLACK__: " + myBLACK__ + " myGREY__: " + myGREY__ + " myRED__: " + myRED__ + " myWHITE__: " + myWHITE__ + Chr(13), False )
'oText.insertString ( oText.End, "myBLUE__: " + myBLUE__ + " myLIGHTGREY__: " + myLIGHTGREY__ + " myLIMEGREEN__: " + myLIMEGREEN__ + " myYELLOW__: " + myYELLOW__ + Chr(13), False )
'oText.insertString ( oText.End, "myBROWN__: " + myBROWN__ + " myMAGENTA__: " + myMAGENTA__ + " myCOLOURS_Sept: " + myCOLOURS_Sept + Chr(13), False )
'oText.insertString ( oText.End, "myBLACK__: " + RGB(0,0,0) + " myGREY__: " + RGB(100,100,100) + " myRED__: " + RGB(255,0,0) + " myWHITE__: " + RGB(255,255,255) + Chr(13), False )
myBLACK__ = RGB(0,0,0)
myGREY__ = RGB(100,100,100)
myRED__ = RGB(255,0,0)
myWHITE__ = RGB(255,255,255)
myBLUE__ = RGB(0,0,255)
myLIMEGREEN__ = RGB(50,205,50)
myYELLOW__ = RGB(255,255,0)
myBROWN__ = RGB(140,40,0)
myMAGENTA__ = RGB(255,0,255)
myLIGHTGREY__ = RGB(220,220,220)
file_$ = "D:\xxx\test_RGB.ods"
oDoc = FileOpen(file_$)
oSheets = oDoc.getSheets() 'Liste aller Tabellenblätter
oSheet = oDoc.createInstance( "com.sun.star.sheet.Spreadsheet" )
If Not oSheets.hasByName("test_RGB") Then
oSheets.insertByName("test_RGB", oSheet)
Else
oSheets.removeByName("test_RGB")
oSheets.insertByName("test_RGB", oSheet)
End If
oSheet = oSheets.getByName("test_RGB")
oDrawPage = oSheet.DrawPage
oTextf = oDoc.createInstance("com.sun.star.drawing.TextShape")
mPoint.X = 2000
mPoint.Y = 2000
mSize.Width = 2000
mSize.Height = 1000
oDrawPage.add(oTextf)
With oTextf
'.FillColor = RGB(Red(myLIGHTGREY__),Blue(myLIGHTGREY__),Green(myLIGHTGREY__))
.FillColor = myLIGHTGREY__
.LineStyle = com.sun.star.drawing.LineStyle.SOLID
'.LineColor = RGB(Red(myGREY__),Blue(myGREY__),Green(myGREY__))
.LineCOLOR = myGREY__
.textVerticalAdjust = com.sun.star.drawing.TextVerticalAdjust.CENTER
.textHorizontalAdjust = com.sun.star.drawing.TextHorizontalAdjust.CENTER
.FillStyle = com.sun.star.drawing.FillStyle.SOLID
.String = "test_RGB"
.CharFontName = "Arial"
.CharHeight = 12
'.CharColor = RGB(Red(myRED__),Blue(myRED__),Green(myRED__))
.CharColor =myRED__
.CharWeight = com.sun.star.awt.FontWeight.BOLD
End With
oTextf.setPosition(mPoint)
oTextf.setSize(mSize)
End Sub
Thanks again for helping