yuhuihu / excellibrary

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

Font Records #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

The current version of the library does not seem to store Font records.  
Am I mistaken?  

It does not seem difficult to store font records and make them accessible 
through the workbook.  I have modified the files below in the following 
ways to account for font records:

1. SharedResource - added Fonts() list
2. WorkbookDecoder.decodeRecords - adds FONT records to the Fonts() list 
in SharedResource
3. Added RichTextFormat class to SubRecords folder.
4. SST (extended version) - added variable to hold all "RichTextFormat" 
data for all strings in SST
5. SST (extended version) - modified decode() to call readStringRTF() read 
the RichText info into a separate variable
6. Record - added ReadStringRTF(), which reads and stores the "rich text 
format" data associated with a string
7. Record - added decodeRichTextFormatting()

I've also attached my revised Worksheet file.  I am interested in 
retrieving the font record for a given character in a cell.  I implemented 
a binary search through the rich-text formatting runs (stored as in the 
attached files), although I did this using an old version of your project, 
so it does not compile properly now.  

Anyway, I hope you implement the font records in a forthcoming update.  It 
would be really helpful.

Original issue reported on code.google.com by sunilshe...@gmail.com on 19 Feb 2009 at 2:22

Attachments:

GoogleCodeExporter commented 9 years ago
SimpleTest.WriteLongTextTest() is failing at r35

Original comment by jetcat on 24 Feb 2009 at 12:58

GoogleCodeExporter commented 9 years ago
SimpleTest.WriteLongTextTest() passed on my machine.

Original comment by China.LiuJunFeng on 24 Feb 2009 at 3:01

GoogleCodeExporter commented 9 years ago
I am getting the following error:

TestCase 'ExcelLibrary.Test.SimpleTest.WriteLongTextTest'
failed: System.Exception : invalid size of rich text formatting information
    C:\excellibrary\trunk\src\ExcelLibrary\Office\Excel\BinaryFileFormat\Decode\StringDecoder.cs(176,0): at ExcelLibrary.BinaryFileFormat.StringDecoder.ReadString(Int32 lengthbits, RichTextFormat& rtf)
    C:\excellibrary\trunk\src\ExcelLibrary\Office\Excel\BinaryFileFormat\Extended\SST.cs(24,0): at ExcelLibrary.BinaryFileFormat.SST.Decode()
    C:\excellibrary\trunk\src\ExcelLibrary\Office\Excel\BinaryFileFormat\Decode\WorkbookDecoder.cs(85,0): at ExcelLibrary.BinaryFileFormat.WorkbookDecoder.DecodeRecords(List`1 records, SharedResource& sharedResource)
    C:\excellibrary\trunk\src\ExcelLibrary\Office\Excel\BinaryFileFormat\Decode\WorkbookDecoder.cs(19,0): at ExcelLibrary.BinaryFileFormat.WorkbookDecoder.Decode(Stream stream)
    C:\excellibrary\trunk\src\ExcelLibrary\Office\Excel\SpreadSheet\Workbook.cs(29,0):
at ExcelLibrary.SpreadSheet.Workbook.Open(String file)
    C:\excellibrary\trunk\src\ExcelLibrary.Test\SimpleTest.cs(86,0): at
ExcelLibrary.Test.SimpleTest.WriteLongTextTest()

===

It appears that when decoding string that is longer than 2000 character, then
StringDecoder throws exception (line 174)

Original comment by jetcat on 26 Feb 2009 at 12:40

GoogleCodeExporter commented 9 years ago
Yes, the following debug purpose code can be removed.
if (stringlength > 2000 || firstpart.Length > 2000 || size > 2000)
{
     throw new Exception("invalid size of rich text formatting information");
}

Original comment by China.LiuJunFeng on 26 Feb 2009 at 2:34