Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'hotfix/sharedStringsWithAttributes' into develop
  • Loading branch information
githubsdk committed Sep 28, 2014
2 parents 8e15635 + cdf65ec commit 7e1a6cb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
Binary file modified src/Example Spreadsheet.xlsx
Binary file not shown.
4 changes: 3 additions & 1 deletion src/LoadXLSXExample.as
Expand Up @@ -51,7 +51,9 @@ package
var sheet_1:Worksheet=excel_loader.worksheet("Sheet1");

//Access a cell in sheet 1 and output to trace
trace("Cell A3="+sheet_1.getCellValue("A3")) //outputs: Cell A3=Hello World;
trace("Cell A3=" + sheet_1.getCellValue("A3")) //outputs: Cell A3=Hello World;
trace("Cell A4=" + sheet_1.getCellValue("A4"))//outputs: Cell A4=Hello Excel with colors;
trace("Cell A5=" + sheet_1.getCellValue("A5"))//outputs: Cell A3=Hello Excel with the same color;
}
}
}
6 changes: 4 additions & 2 deletions src/com/childoftv/xlsxreader/Worksheet.as
Expand Up @@ -177,10 +177,12 @@ package com.childoftv.xlsxreader
//trace(sharedString(item.v.toString()));
if(item.f.(children().length()!=0)+""=="") // If it's the result of a formula, no need to replace
{
var content:String = "";
if(item.@t=="str")
item.v=fileLink.sharedString(item.v.toString());
content=fileLink.sharedString(item.v.toString());
if(item.@t=="s")
item.v=fileLink.sharedString(item.v.toString());
content = fileLink.sharedString(item.v.toString());
item.v = content;
}
}
return copy;
Expand Down
49 changes: 44 additions & 5 deletions src/com/childoftv/xlsxreader/XLSXLoader.as
Expand Up @@ -24,15 +24,15 @@ package com.childoftv.xlsxreader



import deng.fzip.FZip;
import deng.fzip.FZipFile;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.utils.Dictionary;

import deng.fzip.FZip;
import deng.fzip.FZipFile;


[Event(name="complete",type="flash.events.Event")]
Expand Down Expand Up @@ -240,8 +240,45 @@ package com.childoftv.xlsxreader
else
{


return sharedStrings().child(index).t.toString();;
var list:XMLList = sharedStrings().child(index);
var content:String = "";
var length:uint = list.r.length();
// rows with font attributes
/* e.g.
<si>
<r>
<t>desc_</t>
</r>
<r>
<rPr>
<sz val="11"/>
<color rgb="FF00FF00"/>
<rFont val="宋体"/>
<family val="3"/>
<charset val="134"/>
<scheme val="minor"/>
</rPr>
<t>txt</t>
</r>
*/

if (length>0)
{
for (var i:int = 0; i < length; ++i )
{
content += list.r[i].t.toString();
}
}else {

/*
e.g.
<si>
<t>buy</t>
</si>
*/
content = list.t.toString();
}
return content;
}
}
private function retrieveXML(path:String):XML
Expand All @@ -256,9 +293,11 @@ package com.childoftv.xlsxreader
private function convertToOpenXMLNS(s:String):XML
{

XML.ignoreProcessingInstructions=true;
XML.ignoreProcessingInstructions = true;
XML.ignoreWhitespace = false;
var XMLDoc:XML=XML(s);
XMLDoc.normalize();
XML.ignoreWhitespace = true;
return XMLDoc;
}

Expand Down

0 comments on commit 7e1a6cb

Please sign in to comment.