tgui78 / excellibrary

Automatically exported from code.google.com/p/excellibrary
0 stars 0 forks source link

Problem with "window.ActiveWorksheet = 0;" in M$ Office 2003 (SP3) #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Steps to reproduce the problem:

1. create a XLS 
2. Open it with M$ 2003 SP3

The "index to active (displayed) worksheet" WINDOW1 Offset 10 Size 2
doesn't work for Office 2003 SP3

(for example: window.ActiveWorksheet = 0;) I can see the first worksheet
(of 2 for example) but the name of the worksheet isn't bold, the worksheet
isn't activated. You can try to print the sheet, then it will tell you that
there aint any data to print at the active sheet.

I think its a M$ Office BIFF8 problem, because its shows ok with OpenOffice
3.x. The right worksheet is active and the worksheet name is bold, i can
print it. 

Can you help? What can I do, to fix it?

System: Windows XP 64bit latest updates, english
Office: M$ Office 2003 (SP3) Professional, german

and your latest great library!

Original issue reported on code.google.com by ingo.bor...@gmail.com on 13 May 2009 at 1:30

GoogleCodeExporter commented 8 years ago
You need to modify the library code to add Window2 record in Worksheet.

1. add Window2.cs in your library (Attached file)
2. In Record.cs, add those 2 lines in the switch statement
                      case RecordType.WINDOW2:
                      return new WINDOW2(record);
3. In WorkSheetEncoder.cs, add those lines after "records.Add(bof);"            

WINDOW2 window2 = new WINDOW2();
window2.OptionFlags = 0x07be;
window2.IndexFirstVisibleRow = 1;
window2.IndexFirstVisibleColumn = 1;
window2.ColorIndex = 0;
window2.NotUsed1 = 0;
window2.CachedMagFactorPB = 0;
window2.CachedMagFactorNV = 0;
window2.NotUsed2 = 0;
records.Add(window2);

4. You must also add "window.ActiveWorksheet = 0;" in WorkbookEncoder.cs

This Window2 record is based on page 216-217 of the excelfileformat document.
I've looked into valid excel files to find the default flag (0x07be)

Hope this help you

Original comment by michel.h...@gmail.com on 16 Oct 2009 at 3:48

Attachments:

GoogleCodeExporter commented 8 years ago
Errata

Should be 

window2.IndexFirstVisibleRow = 0;
window2.IndexFirstVisibleColumn = 0;

0 is the first row/column

Original comment by michel.h...@gmail.com on 16 Oct 2009 at 5:25

GoogleCodeExporter commented 8 years ago
Thanks, it works very well. Now the first Worksheet is active and selected and 
i can
print it :)

Someone can close this issue.

Original comment by ingo.bor...@gmail.com on 12 Nov 2009 at 9:50

GoogleCodeExporter commented 8 years ago
The code in Comment 1, part 3 (WINDOW2 window2 = new WINDOW2; etc) should be 
inserted just before the "EOF eof = new EOF();" statement. This will remove the 
error message "Office File Validation detected a problem..." when opening the 
xls-file.    

Original comment by oyv...@rustan.no on 15 Aug 2011 at 7:43

GoogleCodeExporter commented 8 years ago
I still have the error message : Office File Validation.. after inserting 
(WINDOW2 window2 = new WINDOW2;...) just before the "EOF eof = new EOF();".
Can it fixed?

Original comment by kyunga...@gmail.com on 18 Jul 2012 at 5:17

GoogleCodeExporter commented 8 years ago
What is your excel version?

Original comment by michel.h...@gmail.com on 13 Sep 2012 at 5:24

GoogleCodeExporter commented 8 years ago
Just commented on Issue 137. See if it fixes your problem.

Original comment by mrjames...@gmail.com on 28 Sep 2012 at 8:43

GoogleCodeExporter commented 8 years ago
Why is this not in the trunk of the project? The fix on this issue AND the fix 
of Issue 137 where very useful in one of my project. 

Thanks a lot.

Original comment by muffunke...@gmail.com on 19 Dec 2012 at 4:49

GoogleCodeExporter commented 8 years ago
Corrected file "window2.cs". Also fixes issue 137.

Solved problem with Office 2013.
Not solved problem with office 2010.

Original comment by marek.le...@gmail.com on 16 Apr 2013 at 10:08

Attachments:

GoogleCodeExporter commented 8 years ago
Here is the recompiled ExcelLibrary with the fixed printing functionality.

Original comment by Arel.Celis on 30 Sep 2014 at 8:23

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have download the latest excelLibrary from above but still I am seeing same 
"security alert office file validation". could someone please provide correct 
dll
I am using Office 2007 

Original comment by kumar...@googlemail.com on 29 Apr 2015 at 11:12

GoogleCodeExporter commented 8 years ago
I have done the changes described in the issue and works perfectly now.
I am attaching most recent compiled dll. This may help someone who is having 
same issue

Original comment by kumar...@googlemail.com on 1 May 2015 at 1:46

Attachments: