Ask Your Question

How to get the measure of indentation for a cell?

asked 2018-12-19 17:01:29 +0100

Lupp gravatar image

A few minutes ago a question to this effect by someone else was posted. It was deleted since obviously. Because I already had made up an answer I will post it now nonetheless.
To be able to do so, I posted this question.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-12-19 17:04:06 +0100

Lupp gravatar image

updated 2018-12-19 17:12:07 +0100

I personally never use cell indentation, and I would dissuade of. Like any attributes it should under no circumstances be used as a "surrogate for explicit data". Sheets doing so wrongly may be repaired with the help of the function posted below.
I wrote it years ago to answer another question somewhere else.

Function getCellIndent(pSheet As Long, pCol As Long, pRow As Long)
REM The result uses the SI unit m.
Dim theDoc As Object
Dim theSheet As Object
Dim theCell As Object 
'Catching some foreseeable errors. Assigning the irregular value -1 as indicator.
pSheet            = Int(pSheet)
pCol              = Int(pCol)
pRow              = Int(pRow)
theDoc            = ThisComponent
If (pSheet<1) OR (pSheet>theDoc.Sheets.Count) OR (pCol<1) _
              OR (pCol>1024) OR (pRow<1) OR (pRow>1048576) Then
    getCellIndent = -1
    Exit Function
End If  
On Error Goto errorExit:
theSheet = theDoc.Sheets(pSheet-1)
theCell  = theSheet.getCellByPosition(pCol-1, pRow-1)
getCellIndent = theCell.ParaIndent*1E-5
End Function

It seems to still work as expected, but also see this thread and the comment by @Regina there.

A little dem you find here.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-19 17:01:29 +0100

Seen: 18 times

Last updated: Dec 19 '18