Steffen,
please find the basic code who inserts graphics in Tablecells using the
cell dimensions to dimensioning the grapgics.
Finding the dimensions off a cell can be tricky when cells are merged
ect.. therefore i use the dificult to read :-)firts part of the code
hope it helps
Fernand
oText = oDocument.text
RasterofCursor = True
oViewCursor = oDocument.getCurrentController().getViewCursor()
'xray oviewcursor
If Not isEmpty(oViewCursor.TextTable) then ' Cursor is in een Tabel
' sFrameofTabel = TABEL
' inFRameofTabel = true
' RasterofCursor = False
Twidth = oViewCursor.TextTable.width
TTotalpercent = oViewCursor.TextTable.TableColumnRelativeSum
startcell = oViewCursor.cell.cellname
Kindex = asc(left(oViewCursor.cell.cellname,1))-65
Rindex = int(mid(oViewCursor.cell.cellname,2,2))-1
CurRow = oViewCursor.texttable.rows.getbyindex(Rindex)
if CurRow.IsAutoHeight = True then
msgbox De ROWhooghte moet FIXED zijn ! chr(13) Eerst
aanpassen, dan pas kan je verder
exit sub
end if
if
oViewCursor.cell.compareRegionStarts(oViewCursor.cell.getstart,oViewCursor.cell.getend)
0 or oViewCursor.cell.string then
msgbox er mag in de cell enkel één chr(13) RETURN staan
chr(13) Eerst aanpassen, dan pas kan je verder
exit sub
endif
if oViewCursor.paraStylename Standard then
msgbox de ParaGraphStyle in de Tabelcell staat niet op default
chr(13) wordt nu automatisch aangepast !!
oViewCursor.ParaStyleName = Standard
end if
if oViewCursor.CharStylenamethen
msgbox de CharacterStyle in de Tabelcell staat niet op default
chr(13) wordt nu automatisch aangepast !!
oViewCursor.setPropertyToDefault(CharStyleName)
end if
if oViewCursor.texttable.Horiorient = 6 then
msgbox De Table mag niet AUTOMATISCH gealigneerd zijn chr(13)
wordt nu automatisch aangepast naar center !!
oViewCursor.texttable.Horiorient = 2
end if
' welke cell ??
startcellname = oViewCursor.cell.cellname
startrow = int(mid(startcellname,2,2))
if oViewCursor.cell.VertOrient 2 then
msgbox Cursor staat niet in de HOOGTE gecentreerd chr(13)
wordt nu automatisch aangepast !!
oViewCursor.cell.VertOrient = 2
end if
if oViewCursor.cell.createEnumeration.nextelement.paraAdjust 3 then
msgbox Tabelcell-Cursor is Niet in de BREEDTE gecentreerd
chr(13) wordt nu automatisch aangepast !!
oViewCursor.cell.createEnumeration.nextelement.paraAdjust = 3
end if
oViewcursor.goDOWN(1,false) ' de tabel MOET in een FRame
zitten anders problemen bij de onderste rij !
if isEmpty(oViewCursor.TextTable) then
startcellpos = ONDER
oViewcursor.goUP(1,false)
end if
if startcellpos = ONDER then
'eerst terug naar startcell
otext = oviewcursor.texttable.getcellbyname(startcellname,true).text
otabelCursor = oText.createTextCursor()
oViewcursor.gotorange(otabelCursor,false)
' xray oViewcursor
If otext.supportsService(com.sun.star.text.Paragraph) then
print is paragraaf
exit sub
end if
laatsterow = oViewCursor.TextTable.rows.count
if laatsterow = int(mid(oViewCursor.cell.cellname,2,2)) then ' cell
is één row hoog
iFotH = oViewCursor.texttable.rows.getbyindex(Rindex).height
else
for i= 0 to laatsterow - int(mid(oViewCursor.cell.cellname,2,2))
iFotH = iFotH + oViewCursor.texttable.rows.getbyindex(Rindex+ i
).height
next i
end if
else 'cell boven of midden
' eerst terug naar de startcell
otext = oviewcursor.texttable.getcellbyname(startcellname,true).text
otabelCursor = oText.createTextCursor()
oViewcursor.gotorange(otabelCursor,false)
startrow = int(mid(oViewCursor.cell.cellname,2,2))
oViewcursor.goDOWN(1,false)
volgenderow = int(mid(oViewCursor.cell.cellname,2,2))
if isEmpty(oViewCursor.TextTable) then 'terug naar binnen de tabel
oViewcursor.goUP(1,false)
end if
' terug naar de startcell
otext = oviewcursor.texttable.getcellbyname(startcellname,true).text
otabelCursor = oText.createTextCursor()
oViewcursor.gotorange(otabelCursor,false)
for i= 1 to volgenderow - startrow
iFotH = iFotH + oViewCursor.texttable.rows.getbyindex(Rindex + i-1
).height
next i
endif
' iFotH = CurRow.height
tabstops = CurRow.TableColumnSeparators()
if uBound(tabstops) 0 then
iFotW = tWidth
else
if kindex = 0 then
iFotW = (twidth * tabstops(Kindex).position/TTotalpercent)
elseif kindex -1 = ubound(tabstops) then
iFotW = twidth - (twidth *
tabstops(Kindex-1).position/TTotalpercent)
else
iFotW = (twidth * tabstops(Kindex).position/TTotalpercent) -
(twidth * tabstops(Kindex-1).position/TTotalpercent)
endif
end if
otext = oViewCursor.text