View Issue Details

IDProjectCategoryView StatusLast Update
0002073JEDI VCL00 JVCL Componentspublic2006-06-19 06:24
ReportermaxpAssigned Toivan_ra 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.30 
Summary0002073: OLE automation support does not work correctly in JvInterpreter
DescriptionRun JvInterpreterTest. Select 'sample - excel.pas'. Try to run. First error (type mismatch) occurs in line
"Cell.Value := 'Line ' + Line;"
After changing this line to
"Cell.Value := 'Line ' + IntToStr(Line);"
this part works, but it is definitely incorrect behaviour, because Cell.Value should behave as Variant type.
The second error (OLE error 800A03EC occurs in lines
Range := ExcelWindow.Range(ExcelWindow.Cells(1, 1),
                          ExcelWindow.Cells(LineCount + 1, ColumnCount + 1));

and so on.
TagsNo tags attached.

Relationships

related to 0003730 resolvedivan_ra JvInterpreter memory leak 

Activities

maxp

2006-05-30 11:56

reporter   ~0009363

It seems that in the last JVCL version all is OK.

ivan_ra

2006-05-31 02:55

developer   ~0009366

This was fixed in revision 10586 (example 'sample - excel.pas').

But JvInterpreter still incompatible with Delphi ole automation call sintaxis: in Delphi we write Excel.Cells[1,2], but in JvInterpreter scripts we must write Excel.Cells(1,2).
In Delphi square brackets [] in OLE call means property, and compiler calls DispInvoke with DISPATCH_PROPERTYGET flag; In other hand, round brackets ()means method call (DispInvoke called with DISPATCH_METHOD or sometimes with DISPATCH_METHOD or DISPATCH_PROPERTYGET).
Thats why correct Delphi sintaxis is:
Excel.Cells[1,2]
Excel.ActiveWorkbook.SaveAs('text.xls');

In JvInterpreter scripts call "Excel.Cells[1,2]" not works.
This is fixible (some work with TJvInterpreterAdapter.DispatchCall and TJvInterpreterAdapter.GetValue), and I can do it. But this is problem: people who works with with JvInterpreter already have scripts, which can become unworkable after JvInterpreter fix. So, I suggest for a while to permit both types of OLE call:
Excel.Cells[1,2]
Excel.Cells(1,2)
In this case tvery OLE call will be with DISPATCH_METHOD or DISPATCH_PROPERTYGET flag.

Any comments?

maxp

2006-05-31 03:09

reporter   ~0009367

IMHO, it would be better do not make overfixes since the current realization is working. Anyway JvInterpreter syntax is not 100% compartible with Delphi.

2006-05-31 03:35

 

JvInterpreter.pas.patch (678 bytes)
Index: JvInterpreter.pas
===================================================================
--- JvInterpreter.pas	(revision 10628)
+++ JvInterpreter.pas	(working copy)
@@ -4237,7 +4237,21 @@
       end;
       if Result then
         Exit;
-    end; 
+    end
+    else
+    if Args.ObjTyp = varDispatch then
+    { Ole automation call }
+    begin
+      {$IFDEF JvInterpreter_OLEAUTO}
+      Result := DispatchCall(Identifier, Value, Args, True);
+      if Result then begin
+        Args.ReturnIndexed := True;
+        Exit;
+      end;
+      {$ELSE}
+      NotImplemented(RsOleAutomationCall);
+      {$ENDIF JvInterpreter_OLEAUTO}
+    end;
   end
   else
   begin

ivan_ra

2006-05-31 03:39

developer   ~0009368

This is patch allowing both types of OLE call:
Excel.Cells[1,2] // legal Delphi call
Excel.Cells(1,2) // old JvInterpreter call

There is no additional property/method control, so functionality only extended

obones

2006-06-09 05:24

administrator   ~0009534

Ivan, can this be marked as resolved?

ivan_ra

2006-06-09 05:42

developer   ~0009540

I can commit it into SVN, but my work file also includes solution for 0003730. Waiting for response

obones

2006-06-09 06:19

administrator   ~0009548

Then please do it when you get the answer.

ivan_ra

2006-06-19 06:24

developer   ~0009603

this is now in SVN

Issue History

Date Modified Username Field Change
2004-08-20 01:14 maxp New Issue
2006-05-30 11:56 maxp Note Added: 0009363
2006-05-31 02:55 ivan_ra Note Added: 0009366
2006-05-31 02:55 ivan_ra Status new => feedback
2006-05-31 03:09 maxp Note Added: 0009367
2006-05-31 03:35 ivan_ra File Added: JvInterpreter.pas.patch
2006-05-31 03:39 ivan_ra Note Added: 0009368
2006-06-09 05:24 obones Note Added: 0009534
2006-06-09 05:42 ivan_ra Note Added: 0009540
2006-06-09 06:16 obones Relationship added related to 0003730
2006-06-09 06:19 obones Note Added: 0009548
2006-06-19 06:24 ivan_ra Status feedback => resolved
2006-06-19 06:24 ivan_ra Fixed in Version => Daily / SVN
2006-06-19 06:24 ivan_ra Resolution open => fixed
2006-06-19 06:24 ivan_ra Assigned To => ivan_ra
2006-06-19 06:24 ivan_ra Note Added: 0009603