Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/ActiveX/Samples/Servers/MS Office    [ Add a report in this area ]  
Report #:  103507   Status: Open
XE2 and MS Office
Project:  Delphi Build #:  16.0.4358.45540
Version:    16.3 Submitted By:   Evgeny Boltik
Report Type:  Basic functionality failure Date Reported:  2/18/2012 4:18:58 AM
Severity:    Critical / Show Stopper Last Updated: 6/13/2013 5:45:10 PM
Platform:    All versions Internal Tracking #:   25371
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Delphi D2007 Ok
Delphi XE2 Error

---------------------------
Project1
---------------------------
?????? ?????????? ???????? HorizontalAlignment ?????? Range.
---------------------------
??  
---------------------------

const
  xlTop           = $FFFFEFC0;
  xlBottom        = $FFFFEFF5;
  xlCenter        = $FFFFEFF4;
  xlLeft          = $FFFFEFDD;
  xlRight         = $FFFFEFC8;

procedure TForm1.Button1Click(Sender: TObject);
var
  Programa : Variant;
  Document : Variant;
  ActiveSheet : Variant;
  VRange : Variant;
begin
  Programa := CreateOleObject('Excel.Application');
  Programa.Application.Visible := True;
  Programa.WorkBooks.Add();
  Document := Programa.ActiveWorkBook;
  ActiveSheet := Document.ActiveSheet;
  VRange := ActiveSheet.Cells[1, 1];
  VRange.HorizontalAlignment := xlCenter;
end;
Steps to Reproduce:

Added by Sysop
<<<<<<
This issue is releated to Release note of Update 4.
http://docwiki.embarcadero.com/RADStudio/en/Release_Notes_for_XE2_Update_4#Automation_Servers_and_Unsigned_Integers
>>>>>>
Workarounds
Use this line
VRange.HorizontalAlignment := Integer(xlCenter);
instead of
VRange.HorizontalAlignment := xlCenter;
Attachment
None
Comments

Tomohiro Takahashi at 2/18/2012 10:16:54 PM -
What version of MS Office do you use?

Uwe Schuster at 2/19/2012 1:40:14 AM -
XE2 does dispatch enumerations as unsigned integers instead of signed now and without testing I guess the problem is the following line of your snippet

  VRange.HorizontalAlignment := xlCenter;

Changing it into

  VRange.HorizontalAlignment := Integer(xlCenter);

may fix the issue. For more, but preliminary information refer to

http://docwiki.embarcadero.com/RADStudio/en/Release_Notes_for_XE2_Update_4#Automation_Servers_and_Unsigned_Integers

Evgeny Boltik at 2/22/2012 12:33:23 AM -
I have tested Office 2003.

ShowMessage('1');
  VRange.HorizontalAlignment := integer(xlCenter);
OK
  ShowMessage('2');
  VRange.HorizontalAlignment := integer(xlRight);
Ok
  ShowMessage('3');
  VRange.HorizontalAlignment := xlCenter;
Error

Evgeny Boltik at 2/22/2012 1:41:03 AM -
Updete 4 not found in http://cc.embarcadero.com/reg/delphi
When will have update?

Tomohiro Takahashi at 2/22/2012 7:01:14 PM -
It will be released soon.

Evgeny Boltik at 2/22/2012 3:10:38 AM -
WARNING!!!!
  VRange.Value := '7';
error value excel a1 = 55

  VRange.Value := ansistring('7');
OK value excel a1 = 7

Evgeny Boltik at 2/22/2012 3:44:49 AM -
  VRange.NumberFormat := '@';
  ShowMessage('VRange.NumberFormat='+VRange.NumberFormat);

"VRange.NumberFormat = 64" Error

if

var
  s : String;
...
  s := '@';
  VRange.NumberFormat := S;

or

  VRange.NumberFormat := AnsiString('@');

then
"VRange.NumberFormat = @" OK

Evgeny Boltik at 5/9/2012 10:42:29 PM -
When will update? (2 months have passed)

Tomohiro Takahashi at 5/9/2012 11:53:24 PM -
As you know, QualityCentral is just reporting area. So, if you need more intensive suppport and official reply from Embarcaderi, please contact technical support service. Sorry for the inconvenience.
http://support.embarcadero.com/

Tomohiro Takahashi at 6/13/2013 5:44:35 PM -
This is a comment from internal tracking system.
<<<<<<<
According to http://docwiki.embarcadero.com/RADStudio/XE2/en/Release_Notes_for_XE2_Update_4#Automation_Servers_and_Unsigned_Integers , this issue can be marked as "Work as expected", because this issue is mentioned in the release notes.
However. we do not close this issue because maybe the plan is to be fixed sometimes.
>>>>>>>

Server Response from: ETNACODE01