Commit b8fbe262 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

при чтении из бинарника учитываю paraRun

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55578 954022d7-b5bf-4e40-9824-e11837661b57
parent cda028bf
...@@ -3296,6 +3296,7 @@ ...@@ -3296,6 +3296,7 @@
var row, colorText, cTextPr, fontFamily = "Arial"; var row, colorText, cTextPr, fontFamily = "Arial";
var text = null; var text = null;
var oNewItem = []; var oNewItem = [];
var paraRunContent;
var aResult = this.aResult; var aResult = this.aResult;
if(row === undefined) if(row === undefined)
...@@ -3327,7 +3328,7 @@ ...@@ -3327,7 +3328,7 @@
//backgroundColor //backgroundColor
var backgroundColor = null; var backgroundColor = null;
if(paragraph.Parent && paragraph.Parent.Parent && paragraph.Parent.Parent instanceof CTableCell2 && paragraph.Parent.Parent.CompiledPr && paragraph.Parent.Parent.CompiledPr.Pr.Shd && paragraph.Parent.Parent.CompiledPr.Pr.Shd.Color) if(paragraph.Parent && paragraph.Parent.Parent && paragraph.Parent.Parent instanceof CTableCell && paragraph.Parent.Parent.CompiledPr && paragraph.Parent.Parent.CompiledPr.Pr.Shd && paragraph.Parent.Parent.CompiledPr.Pr.Shd.Color)
{ {
var color = paragraph.Parent.Parent.CompiledPr.Pr.Shd.Color; var color = paragraph.Parent.Parent.CompiledPr.Pr.Shd.Color;
backgroundColor = new RgbColor(this.clipboard._getBinaryColor("rgb(" + color.r + "," + color.g + "," + color.b + ")")); backgroundColor = new RgbColor(this.clipboard._getBinaryColor("rgb(" + color.r + "," + color.g + "," + color.b + ")"));
...@@ -3363,145 +3364,151 @@ ...@@ -3363,145 +3364,151 @@
if(text == null) if(text == null)
text = ""; text = "";
if(content[n] instanceof ParaRun)
if(content[n] instanceof ParaTextPr2)//settings for text
{ {
if(text !== null && oNewItem[oNewItem.length - 1])//oNewItem - массив, аналогичный value2 paraRunContent = content[n].Content;
oNewItem[oNewItem.length - 1].text = text; for(var pR = 0; pR < paraRunContent.length; pR++)
else if(text !== null && oNewItem.length == 0)
{ {
this.fontsNew["Arial"] = 1; if(paraRunContent[pR] instanceof ParaTextPr)//settings for text
colorText = new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)")); {
if(text !== null && oNewItem[oNewItem.length - 1])//oNewItem - массив, аналогичный value2
var calcValue = content[n].CalcValue; oNewItem[oNewItem.length - 1].text = text;
oNewItem.push({ else if(text !== null && oNewItem.length == 0)
format: { {
fn: calcValue.FontFamily && calcValue.FontFamily.Name ? calcValue.FontFamily.Name : paragraphFontFamily, this.fontsNew["Arial"] = 1;
fs: calcValue.FontSize ? calcValue.FontSize : paragraphFontSize, colorText = new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)"));
c: colorParagraph ? colorParagraph : colorText,
b: paragraphBold, var calcValue = paraRunContent[pR].CalcValue;
i: paragraphItalic, oNewItem.push({
u: paragraphUnderline, format: {
s: paragraphStrikeout, fn: calcValue.FontFamily && calcValue.FontFamily.Name ? calcValue.FontFamily.Name : paragraphFontFamily,
va: "none" fs: calcValue.FontSize ? calcValue.FontSize : paragraphFontSize,
} c: colorParagraph ? colorParagraph : colorText,
}); b: paragraphBold,
oNewItem[oNewItem.length - 1].text = text; i: paragraphItalic,
} u: paragraphUnderline,
s: paragraphStrikeout,
text = ""; va: "none"
}
cTextPr = content[n].CalcValue; });
oNewItem[oNewItem.length - 1].text = text;
if(cTextPr.Color) }
colorText = new RgbColor(this.clipboard._getBinaryColor("rgb(" + cTextPr.Color.r + "," + cTextPr.Color.g + "," + cTextPr.Color.b + ")"));
else text = "";
colorText = null;
cTextPr = paraRunContent[pR].CalcValue;
fontFamily = cTextPr.fontFamily ? fontFamily : cTextPr.RFonts.CS ? cTextPr.RFonts.CS.Name : paragraphFontFamily;
this.fontsNew[fontFamily] = 1; if(cTextPr.Color)
colorText = new RgbColor(this.clipboard._getBinaryColor("rgb(" + cTextPr.Color.r + "," + cTextPr.Color.g + "," + cTextPr.Color.b + ")"));
var verticalAlign; else
if(cTextPr.VertAlign == 2) colorText = null;
verticalAlign = "subscript";
else if(cTextPr.VertAlign == 1) fontFamily = cTextPr.fontFamily ? fontFamily : cTextPr.RFonts.CS ? cTextPr.RFonts.CS.Name : paragraphFontFamily;
verticalAlign = "superscript"; this.fontsNew[fontFamily] = 1;
var verticalAlign;
if(cTextPr.VertAlign == 2)
verticalAlign = "subscript";
else if(cTextPr.VertAlign == 1)
verticalAlign = "superscript";
oNewItem.push({ oNewItem.push({
format: { format: {
fn: fontFamily, fn: fontFamily,
fs: cTextPr.FontSize ? cTextPr.FontSize : paragraphFontSize, fs: cTextPr.FontSize ? cTextPr.FontSize : paragraphFontSize,
c: colorText ? colorText : colorParagraph, c: colorText ? colorText : colorParagraph,
b: cTextPr.Bold ? cTextPr.Bold : paragraphBold, b: cTextPr.Bold ? cTextPr.Bold : paragraphBold,
i: cTextPr.Italic ? cTextPr.Italic : paragraphItalic, i: cTextPr.Italic ? cTextPr.Italic : paragraphItalic,
u: cTextPr.Underline ? cTextPr.Underline : paragraphUnderline, u: cTextPr.Underline ? cTextPr.Underline : paragraphUnderline,
s: cTextPr.Strikeout ? cTextPr.Strikeout : paragraphStrikeout, s: cTextPr.Strikeout ? cTextPr.Strikeout : paragraphStrikeout,
va: verticalAlign ? verticalAlign : paragraphVertAlign va: verticalAlign ? verticalAlign : paragraphVertAlign
}
});
} }
}); else if(paraRunContent[pR] instanceof ParaText)//text
} {
else if(content[n] instanceof ParaText2)//text text += paraRunContent[pR].Value;
{ }
text += content[n].Value; else if(paraRunContent[pR] instanceof ParaSpace)
} {
else if(content[n] instanceof ParaSpace2) text += " ";
{ }
text += " "; else if(paraRunContent[pR] instanceof ParaTab)//tab
} {
else if(content[n] instanceof ParaTab2)//tab if(!oNewItem.length)
{ {
if(!oNewItem.length) fontFamily = paragraphFontFamily;
{ this.fontsNew[fontFamily] = 1;
fontFamily = paragraphFontFamily; colorText = colorParagraph ? colorParagraph : new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)"));
this.fontsNew[fontFamily] = 1;
colorText = colorParagraph ? colorParagraph : new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)")); oNewItem.push({
format: {
oNewItem.push({ fn: fontFamily,
format: { fs: paragraphFontSize,
fn: fontFamily, c: colorText,
fs: paragraphFontSize, b: paragraphBold,
c: colorText, i: paragraphItalic,
b: paragraphBold, u: paragraphUnderline,
i: paragraphItalic, s: paragraphStrikeout,
u: paragraphUnderline, va: paragraphVertAlign
s: paragraphStrikeout, }
va: paragraphVertAlign });
} }
}); if(text !== null)
} oNewItem[oNewItem.length - 1].text = text;
if(text !== null) //переходим в следующую ячейку
oNewItem[oNewItem.length - 1].text = text; if(typeof aResult[row][s + c1] == "object")
//переходим в следующую ячейку aResult[row][s + c1][aResult[row][s + c1].length] = oNewItem;
if(typeof aResult[row][s + c1] == "object") else
aResult[row][s + c1][aResult[row][s + c1].length] = oNewItem; {
else aResult[row][s + c1] = [];
{ aResult[row][s + c1][0] = oNewItem;
aResult[row][s + c1] = [];
aResult[row][s + c1][0] = oNewItem;
}
text = "";
oNewItem = [];
s++;
}
else if(content[n] instanceof ParaEnd2)//end
{
if(!oNewItem.length)
{
fontFamily = paragraphFontFamily;
this.fontsNew[fontFamily] = 1;
colorText = colorParagraph ? colorParagraph : new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)"));
oNewItem.push({
format: {
fn: fontFamily,
fs: paragraphFontSize,
c: colorText,
b: paragraphBold,
i: paragraphItalic,
u: paragraphUnderline,
s: paragraphStrikeout,
va: paragraphVertAlign
} }
});
} text = "";
if(text !== null) oNewItem = [];
oNewItem[oNewItem.length - 1].text = text; s++;
text = ""; }
if(typeof aResult[row][s + c1] == "object") else if(paraRunContent[pR] instanceof ParaEnd)//end
aResult[row][s + c1][aResult[row][s + c1].length] = oNewItem; {
else if(!oNewItem.length)
{ {
aResult[row][s + c1] = []; fontFamily = paragraphFontFamily;
aResult[row][s + c1][0] = oNewItem; this.fontsNew[fontFamily] = 1;
} colorText = colorParagraph ? colorParagraph : new RgbColor(this.clipboard._getBinaryColor("rgb(0, 0, 0)"));
}
else if(n == content.length - 1)//end of row oNewItem.push({
{ format: {
text = ""; fn: fontFamily,
oNewItem = []; fs: paragraphFontSize,
} c: colorText,
b: paragraphBold,
i: paragraphItalic,
u: paragraphUnderline,
s: paragraphStrikeout,
va: paragraphVertAlign
}
});
}
if(text !== null)
oNewItem[oNewItem.length - 1].text = text;
text = "";
if(typeof aResult[row][s + c1] == "object")
aResult[row][s + c1][aResult[row][s + c1].length] = oNewItem;
else
{
aResult[row][s + c1] = [];
aResult[row][s + c1][0] = oNewItem;
}
}
else if(n == paraRunContent[pR].length - 1)//end of row
{
text = "";
oNewItem = [];
}
};
}
}; };
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment