* [ox-odt] "optimal" width of tables
@ 2015-02-24 15:13 Rasmus
2015-02-24 16:17 ` Rasmus
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus @ 2015-02-24 15:13 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Libreoffice has a nice feature called AutoFit → Optimal width of columns.
This seems to minimized the width of tables. By default Org sets the
width to 100% which looks horrible for small tables. From this helpful
post I gather that it can be fixed by a macro.
http://ask.libreoffice.org/en/question/18664/optimal-column-width-for-all-tables-in-odt-documents/
Is there any way to call macros from ox-odt? It seems you can call LO
with the -invisible flag to apply macros without bothering the user...
Anybody got experience in this regard?
—Rasmus
--
With monopolies the cake is a lie!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ox-odt] "optimal" width of tables
2015-02-24 15:13 [ox-odt] "optimal" width of tables Rasmus
@ 2015-02-24 16:17 ` Rasmus
0 siblings, 0 replies; 2+ messages in thread
From: Rasmus @ 2015-02-24 16:17 UTC (permalink / raw)
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Libreoffice has a nice feature called AutoFit → Optimal width of columns.
> This seems to minimized the width of tables. By default Org sets the
> width to 100% which looks horrible for small tables. From this helpful
> post I gather that it can be fixed by a macro.
>
> http://ask.libreoffice.org/en/question/18664/optimal-column-width-for-all-tables-in-odt-documents/
>
> Is there any way to call macros from ox-odt? It seems you can call LO
> with the -invisible flag to apply macros without bothering the user...
So the particular problem can be solved using this macro under OrgMacros:
REM ***** BASIC *****
Sub OptimzeColumnWidth
Dim s As String
Dim i As Long
Dim oTables
Dim oTable
Dim oCell
oTables = ThisComponent.getTextTables()
If NOT oTables.hasElements() Then Exit Sub
For i = 0 To oTables.getCount() - 1
oTable = oTables.getByIndex(i)
ThisComponent.getCurrentController().select(oTable)
oFrame = ThisComponent.CurrentController.Frame
oDispHelper = createUnoService("com.sun.star.frame.DispatchHelper")
oDispHelper.executeDispatch(oFrame, ".uno:SelectTable", "", 0, Array())
oDispHelper.executeDispatch(oFrame, ".uno:SetOptimalColumnWidth", "", 0, Array())
Next
End Sub
Sub OptimizeColumnWidtSaveQuit
OptimzeColumnWidth()
ThisComponent.store()
ThisComponent.close(True)
StarDesktop.Terminate
end Sub
I couldn't figure out how to make comments in LO Basic, so that's why
there's not a back-reference to the url above...
It's called via
libreoffice --invisible --nofirststartwizard --headless --norestore MYFILE.odt "macro:///Standard.OrgMacros.OptimizeColumnWidtSaveQuit()"
This is Makefile-friendly (and ox-publish), but it would be great if we
could (i) collect some useful macros like the above, and (ii) provide an
convenient way to call them on exported documents.
—Rasmus
--
Need more coffee. . .
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-24 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 15:13 [ox-odt] "optimal" width of tables Rasmus
2015-02-24 16:17 ` Rasmus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.