B4J Question [XLUtils] Creating MS Word Documents on the MAC (never resolved previously)

gregchao

Member
Licensed User
Longtime User
I am unable to run this code on the MAC. It works fine in Windows. From the documentation,

https://www.b4x.com/android/forum/threads/xlutils-creating-ms-word-documents.131732/#content

B4X:
Dim wd As WordUtils
wd.Initialize
Dim doc As WordDocument = wd.CreateDocument
doc.Append($"[p]Word document with two lines.
This is the second line.[/p]"$)
Dim f As String = doc.SaveAs(File.DirApp, "1.docx", True)

It runs fine when you run from the IDE but errors when it is packaged. The specific line that errors is
B4X:
Dim doc As WordDocument = wd.CreateDocument
 
Solution
There are several mistakes here:
1. The thread title is meaningless. What does it mean "never resolved previously"? Clearly if you are posting a question then it doesn't work for you.
2. Never write to File.DirApp with standalone packages.
3. You don't need to use toast messages to debug it. Follow this tutorial: https://www.b4x.com/android/forum/threads/macsigner-building-notarized-mac-packages.130890/#content
4. You need to choose Project - Build Standalone Package and then copy the generated packager.json file to your Mac, in the same folder as the jar.

1665667699603.png

gregchao

Member
Licensed User
Longtime User
Since it happens when it is packaged, there is no error message. The program terminates. I had to use toasts to narrow down the line.

To be more specific, when I use the b4j bridge in debug mode, it works fine on the MAC. After I use the macSigner, it errors. There is no error message, it just exits the program.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are several mistakes here:
1. The thread title is meaningless. What does it mean "never resolved previously"? Clearly if you are posting a question then it doesn't work for you.
2. Never write to File.DirApp with standalone packages.
3. You don't need to use toast messages to debug it. Follow this tutorial: https://www.b4x.com/android/forum/threads/macsigner-building-notarized-mac-packages.130890/#content
4. You need to choose Project - Build Standalone Package and then copy the generated packager.json file to your Mac, in the same folder as the jar.

1665667699603.png
 
Upvote 0
Solution

gregchao

Member
Licensed User
Longtime User
Thank you Erel! As you instructed, I needed to put the packager.json file in the same directory as the jar file:

"You need to choose Project - Build Standalone Package and then copy the generated packager.json file to your Mac, in the same folder as the jar."
 
Upvote 0
Top