Issue 119415 - VBA code can't load after open in AOO3.4
VBA code can't load after open in AOO3.4
Status: CLOSED FIXED
Product: App Dev
Classification: Unclassified
Component: vba
OOo 3.3 or older
All All
: P2 normal
: 4.0.0
Assigned To: Chen Peng
:
Depends on:
Blocks: 120823
  Show dependency treegraph
 
Reported: 2012-05-25 09:19 UTC by zongdj
Modified: 2013-07-11 08:11 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
In Excel, click the button, a panel with one checkbox on it will popup. (56.50 KB, application/vnd.ms-excel)
2012-05-25 10:01 UTC, Shan Zhu
no flags Details
another sample, which VBA code can not load (66.50 KB, application/vnd.ms-excel)
2012-09-17 02:13 UTC, Lei Debin
no flags Details
Patch for 119415 (759 bytes, patch)
2012-09-26 03:14 UTC, Chen Peng
chenpeng2006: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description zongdj 2012-05-25 09:19:00 UTC
1.Open the attached sample file in OpenOffice
2.Check the vba code


Defect: All vba code are not load.
Comment 1 Shan Zhu 2012-05-25 10:01:39 UTC
Created attachment 77596 [details]
In Excel, click the button, a panel with one checkbox on it will popup.

Opening this sample file in AOO3.4 can also reproduce this problem.
Comment 2 Regina Henschel 2012-05-25 11:52:04 UTC
If I open the attached file in Excel 2010 and save it without any changes to a new file, that file is opened correctly in AOO3.4. The code is there and runs correctly.
Comment 3 Li Feng Wang 2012-06-12 08:41:43 UTC
Can't run the macro in attached sample file with AOO3.4
Comment 4 Lei Debin 2012-09-17 02:13:45 UTC
Created attachment 79522 [details]
another sample, which VBA code can not load

Please check the sample file, the vba code can not load correctly.
Comment 5 Regina Henschel 2012-09-17 11:51:49 UTC
When I open the file with a debug build of r1378069 I get these errors:

Error: XclImpStream::Ignore - record overread From File C:/AOO_2012_07_git/trunk/main/sc/source/filter/excel/xistream.cxx at Line 887

Error: TextInputStream::createXTextInputStream - unsupported text encoding From File C:/AOO_2012_07_git/trunk/main/oox/source/helper/textinputstream.cxx at Line 198

Error: ### default context of service manager singleton differs from context holding it! From File C:/AOO_2012_07_git/trunk/main/stoc/source/servicemanager/servicemanager.cxx at Line 1293

Error: VbaProject::importVba - form substorage without form module From File C:/AOO_2012_07_git/trunk/main/oox/source/ole/vbaproject.cxx at Line 481
Comment 6 Chen Peng 2012-09-26 03:10:45 UTC
Root Cause: 
   The sample was created by Chinese MS Excel 2003, the textencoding value of this is 61, when call the pcCharset = rtl_getMimeCharsetFromTextEncoding( eTextEnc), it will return null, so can't set the text stream of VBA and can't load the VBA code in AOO.

Resolution:
   Change the rtl_getMimeCharsetFromTextEncoding( eTextEnc) to rtl_getBestMimeCharsetFromTextEncoding( eTextEnc) to get the right Charset, then can set the VBA text stream to load VBA code in AOO.
Comment 7 Chen Peng 2012-09-26 03:14:39 UTC
Created attachment 79639 [details]
Patch for 119415
Comment 8 Wang Lei 2012-09-27 07:54:58 UTC
The patch looks good. Submit in revision 1390869
Comment 9 binguo 2012-11-16 08:03:15 UTC
Verified on Aoo_Trunk_20121109.1800 Rev.1407366
Still can run the macro attached in sample file, so reopen it.
Comment 10 binguo 2012-11-16 08:04:24 UTC
Sorry for the typo in the comment above, Still can NOT run the macro


(In reply to comment #9)
> Verified on Aoo_Trunk_20121109.1800 Rev.1407366
Still can run the macro
> attached in sample file, so reopen it.
Comment 11 binguo 2012-11-26 02:51:18 UTC
changed the macro security level from default value to low one, and also checked "Executable code" on from the settings of VBA properties in Options dialog, the bug does not repro, it is fixed.
Comment 12 binguo 2012-11-26 02:51:47 UTC
Verified it on latest AOO trunk build.
Comment 13 binguo 2012-11-26 02:52:29 UTC
close it.
Comment 14 hdu@apache.org 2013-07-11 08:11:28 UTC
Update target to release that will contain it.