Ask Your Question
1

How do i write a macro that will increase / decrease font size within a cell in Calc?

asked 2019-12-26 19:35:40 +0100

daasenior gravatar image

updated 2019-12-28 07:52:09 +0100

ebot gravatar image

How do i write a macro that will increase / decrease font size within a cell in Calc?

EDIT ebot: yelling off

edit retag flag offensive close merge delete

Comments

Could you please explain what Get SUM result depending on filter result in calc got to do with (yelling) HOW DO i WRITE A MACRO THAT WILL INCREASE / DECREASE FONT SIZE WITHIN A CELL IN CALC?

Opaque gravatar imageOpaque ( 2019-12-26 20:06:10 +0100 )edit

changed summary

kompilainenn gravatar imagekompilainenn ( 2019-12-27 19:54:10 +0100 )edit

The "within" is doubtable. The font size (.CharHeight) is generally set for a CellStyle or by direct formatting for a cell or cell range. To set it inside (within) a cell for textportions requires to describe these portions.
I read "for" in place of "within".

Lupp gravatar imageLupp ( 2019-12-27 22:48:07 +0100 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2019-12-26 22:22:52 +0100

Lupp gravatar image

updated 2019-12-28 15:50:43 +0100

Concerning cell attributes: The relevant question is, how to pass the SheetCell (or SheetCellRange) on which to operate, to the "macro". This done, it's easy: SCR.CharHeight = yourNewValue (in points).
(SCR being the SheetCellRange object, probably a single cell.)

===Edit 2019-12-28 about 14:40UTC===
For those wanting to do it for the CurrentSelection which may be a multirange selection I want to add that the selection object ScCellRangesObj (Regard the plural!) also supports the service "com.sun.star.style.CharacterProperties" and therefore gives setting acces to .CharHeight "and everything". You don't need to roam the single ranges.
===End Edit===

Concerning the sum applied to filtered ranges: =SUBTOTAL(109;yourRangeReference) (see help).
Not wrong, but no longer subsumable under the edited question.

edit flag offensive delete link more
0

answered 2019-12-29 14:38:49 +0100

daasenior gravatar image

Thanks for your assistance, my apologies for shouting and posting in the wrong place! How do I get the character height from the active cell? Thanks

edit flag offensive delete link more

Comments

The "active cell" seems to be something often used in Excel-VBA.
In cases where there is selected exactly one cell (whether highlighted or not) get something alike as the documents current selection (ThisComponent.CurrentSelection). In cases where a range is selected (or multiple ranges) exactly one cell has the keyboard focus (or is prepared to get it if a non-cell object gives it back). To get this cell requires slightly obscure means - or trusting in Option VBAsupport 1 which is a bit more than just experimental. Under this option ActiveCell.CellRange.CharHeight should return what you want.
Please ask a new question for more details.

Lupp gravatar imageLupp ( 2019-12-30 00:39:36 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-12-26 19:35:40 +0100

Seen: 305 times

Last updated: Dec 29 '19