B4J Question (Solved) Error Generate PDF reports [XLUtils]

aeric

Expert
Licensed User
Longtime User
Referring to the example

I can successfully save the excel file but am getting error when exporting the PDF.

You cannot call a method on a null-valued expression.
At line:1 char:58
+ ... application;$workbook = $objExcel.workbooks.open('C:\Users\aeric\Desk ...

B4X:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
You cannot call a method on a null-valued expression.
At line:1 char:58
+ ... application;$workbook = $objExcel.workbooks.open('C:\Users\aeric\Desk ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Cannot index into a null array.
At line:1 char:150
+ ... t.xlsx', 3);$workbook.Sheets[1].ExportAsFixedFormat($xlFixedFormat::x ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray
 
You cannot call a method on a null-valued expression.
At line:1 char:268
+ ... esktop\Pie\B4J\Objects\test.pdf');$objExcel.Workbooks.close();$objExc ...
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Exception calling "Quit" with "0" argument(s): "Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'.
This operation failed because the QueryInterface call on the COM component for the interface with IID
'{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception
from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))."
At line:1 char:296
+ ... \B4J\Objects\test.pdf');$objExcel.Workbooks.close();$objExcel.Quit()}
+                                                         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidCastException
 

aeric

Expert
Licensed User
Longtime User
My guess is this update, (MS said they "fixed" some issues):

Version 2409: September 23​

Version 2409 (Build 18025.20096)

Resolved issues​

Excel​

  • We fixed issues users could encounter applying conditional formatting via the Top10 Interop object in Add-in, which included requiring a restart and potential data loss.

 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…