Excel created have word wrap enabled but Libre dont adjust the row height correctly

Excel created have word wrap enabled but Libre dont adjust the row height correctly.

The words are overlapped when converted to pdf.

Do you have the font that the spreadsheet uses installed on this computer? If the font box shows the font name in italics then it isn’t installed and a substitute font will be used which might have different metrics.

Arial or Times New Roman are normally OK even if not installed as the substitute should match well anyway.

default font is in screenshot

this is how it looks like after export to pdf

Could you upload such a file (or a fragment of a file) that demonstrates the described behavior?

Please find the file
Battery AssemblyNewCheck (1).xlsx (8.0 KB)

Part of the problem is (similar to) tdf#152870 - that the invisible content is visible. Interesting is that it’s in Calc, while the bug is for Writer.

Ignoring the optimal row height property in the document is another bug…

1 Like

I guess I’ve seen this also in printing from Calc, but just thought I forgot to set optimal row height. I’ll have to try to find that file…

… which is even a regression in LO 3.6.

tdf#157468

1 Like

Thank you. The reasons for the problem are explained above.
Workaround - Select rows 1-9, select “Optimal height” from the context menu and OK.

@sokol92 As I am using headless to convert to pdf hence will not be able to make any change in the document before convert .

Actually, if we are talking about the possibility of a workaround (until the mentioned bug is fixed), then it will actually be possible to make

1 Like

This was in fact tdf#123026, fixed in v.24.2 (next Feb).

Do I need to wait till feb 2023? OR can you please suggest workaround for headless conversion of such files into pdf?

See the previous comment by JohnSUN. You’d have to trigger running a macro from the command line.

…and this macro will set the desired row height, possibly change some other parameters (for example, page parameters for export) and export the file to PDF.

Can you please explain more with example?

For example, in the Standard library, in the My Macros section, you create a module XlsxToPDF and place a procedure there that looks something like this:

Option Explicit 

Sub cvrtToPDF(sFileName As String)
Dim oSheets As Variant, oSheet As Variant
Dim i As Long
Dim oDoc As Variant
Dim oCursor As Variant, aTemp As Variant
Dim aArgs(0) As New com.sun.star.beans.PropertyValue
	GlobalScope.BasicLibraries.LoadLibrary("Tools")
	If Not FileExists(sFileName) Then Exit Sub 
	sFileName = ConvertToURL(sFileName)
	aArgs(0).Name  = "Hidden"
	aArgs(0).Value = True

	oDoc = OpenDocument(sFileName, aArgs)
	If IsNull(oDoc) Then Exit Sub 
	oSheets = oDoc.getSheets()
	For i = 0 To oSheets.getCount()-1
		oSheet = oSheets.getByIndex(i)
		oCursor = oSheet.createCursor()
		oCursor.gotoEndOfUsedArea(True)
		oCursor.VertJustify = 1	' Hope that it will be enough`
	Next i
	aTemp = Split(sFileName, ".")
	aTemp(UBound(aTemp)) = ".pdf"
	sFileName = Join(aTemp,".")
	aArgs(0).Name  = "FilterName"
	aArgs(0).Value = "calc_pdf_Export"
	oDoc.StoreToUrl(sFileName,aArgs)
	oDoc.close(True)
End Sub

And now the command line like

"<path to LibreOffice folder\program\soffice.exe"  --headless --nologo "macro:///Standard.XlsxToPDF.cvrtToPDF("""full path\Battery AssemblyNewCheck (1).xlsx""")

will do the job

2 Likes