Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
b92152bd
Commit
b92152bd
authored
Apr 25, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes into _convertTableToText
parent
822ba96b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
49 deletions
+68
-49
common/wordcopypaste.js
common/wordcopypaste.js
+68
-49
No files found.
common/wordcopypaste.js
View file @
b92152bd
...
@@ -2390,42 +2390,33 @@ PasteProcessor.prototype =
...
@@ -2390,42 +2390,33 @@ PasteProcessor.prototype =
_convertTableToText
:
function
(
table
,
obj
)
_convertTableToText
:
function
(
table
,
obj
)
{
{
var
oDoc
=
this
.
oLogicDocument
;
var
oDoc
=
this
.
oLogicDocument
;
var
t
=
this
;
if
(
!
obj
)
{
obj
=
[];
}
var
addTextToRun
=
function
(
oCurRun
,
value
)
/*var parseDocumentContent = function(cDocumentContent, newParagraph, addPararunNum
)
{
{
for
(
var
k
=
0
,
length
=
value
.
length
;
k
<
length
;
k
++
)
for(var
n = 0; n < cDocumentContent.Content.length; n
++)
{
{
var
nUnicode
=
null
;
if(cDocumentContent.Content[n] instanceof Paragraph)
var
nCharCode
=
value
.
charCodeAt
(
k
);
{
if
(
AscCommon
.
isLeadingSurrogateChar
(
nCharCode
))
{
var value = cDocumentContent.Content[n].GetText();
if
(
k
+
1
<
length
)
{
var newParaRun = new ParaRun();
k
++
;
var
nTrailingChar
=
value
.
charCodeAt
(
k
);
nUnicode
=
AscCommon
.
decodeSurrogateChar
(
nCharCode
,
nTrailingChar
);
}
}
else
nUnicode
=
nCharCode
;
if
(
null
!=
nUnicode
)
{
var
Item
;
if
(
0x20
!==
nUnicode
&&
0xA0
!==
nUnicode
&&
0x2009
!==
nUnicode
)
{
Item
=
new
ParaText
();
Item
.
Set_CharCode
(
nUnicode
);
}
else
Item
=
new
ParaSpace
();
//add text
t._addTextIntoRun(newParaRun, value);
oCurRun
.
Add_ToContent
(
k
,
Item
,
false
);
newParagraph.Internal_Content_Add(addPararunNum, newParaRun, false);
}
}
else if(cDocumentContent.Content[n] instanceof CTable)
{
t._convertTableToText(cDocumentContent.Content[n], obj);
}
}
};
}
};*/
if
(
!
obj
)
{
obj
=
[];
}
//row
//row
for
(
var
i
=
0
;
i
<
table
.
Content
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
table
.
Content
.
length
;
i
++
)
{
{
...
@@ -2436,44 +2427,42 @@ PasteProcessor.prototype =
...
@@ -2436,44 +2427,42 @@ PasteProcessor.prototype =
{
{
//content
//content
var
cDocumentContent
=
table
.
Content
[
i
].
Content
[
j
].
Content
;
var
cDocumentContent
=
table
.
Content
[
i
].
Content
[
j
].
Content
;
var
bIsPreviousTable
=
false
;
//parseDocumentContent(cDocumentContent, newParagraph, j);
var
isAddParagraph
=
false
;
//TODO нужно поправить проблему с внутренними таблицами
var
createNewParagraph
=
false
;
var
previousTableAdd
=
false
;
for
(
var
n
=
0
;
n
<
cDocumentContent
.
Content
.
length
;
n
++
)
for
(
var
n
=
0
;
n
<
cDocumentContent
.
Content
.
length
;
n
++
)
{
{
if
(
bIsPreviousTable
)
previousTableAdd
=
false
;
if
(
createNewParagraph
)
{
{
newParagraph
=
new
Paragraph
(
oDoc
.
DrawingDocument
,
oDoc
);
newParagraph
=
new
Paragraph
(
oDoc
.
DrawingDocument
,
oDoc
);
bIsPreviousTable
=
false
;
createNewParagraph
=
false
;
}
}
if
(
cDocumentContent
.
Content
[
n
]
instanceof
Paragraph
)
if
(
cDocumentContent
.
Content
[
n
]
instanceof
Paragraph
)
{
{
var
value
=
cDocumentContent
.
Content
[
n
].
GetText
();
var
value
=
cDocumentContent
.
Content
[
n
].
GetText
();
var
newParaRun
=
new
ParaRun
();
var
newParaRun
=
new
ParaRun
();
addTextToRun
(
newParaRun
,
value
);
t
.
_addTextIntoRun
(
newParaRun
,
value
);
isAddParagraph
=
true
;
newParagraph
.
Internal_Content_Add
(
j
,
newParaRun
,
false
);
newParagraph
.
Internal_Content_Add
(
j
,
newParaRun
,
false
);
/*if(isAddParagraph)
{
obj.push(newParagraph);
isAddParagraph = false;
}
bIsPreviousTable = true;*/
}
}
else
if
(
cDocumentContent
.
Content
[
n
]
instanceof
CTable
)
else
if
(
cDocumentContent
.
Content
[
n
]
instanceof
CTable
)
{
{
if
(
isAddParagraph
)
t
.
_convertTableToText
(
cDocumentContent
.
Content
[
n
],
obj
);
previousTableAdd
=
true
;
}
if
(
!
previousTableAdd
&&
cDocumentContent
.
Content
.
length
>
1
&&
n
!==
cDocumentContent
.
Content
.
length
-
1
)
{
{
obj
.
push
(
newParagraph
);
obj
.
push
(
newParagraph
);
isAddParagraph
=
false
;
createNewParagraph
=
true
;
}
bIsPreviousTable
=
true
;
this
.
_convertTableToText
(
cDocumentContent
.
Content
[
n
],
obj
);
}
}
}
}
}
}
obj
.
push
(
newParagraph
);
obj
.
push
(
newParagraph
);
...
@@ -2482,6 +2471,36 @@ PasteProcessor.prototype =
...
@@ -2482,6 +2471,36 @@ PasteProcessor.prototype =
return
obj
;
return
obj
;
},
},
_addTextIntoRun
:
function
(
oCurRun
,
value
)
{
for
(
var
k
=
0
,
length
=
value
.
length
;
k
<
length
;
k
++
)
{
var
nUnicode
=
null
;
var
nCharCode
=
value
.
charCodeAt
(
k
);
if
(
AscCommon
.
isLeadingSurrogateChar
(
nCharCode
))
{
if
(
k
+
1
<
length
)
{
k
++
;
var
nTrailingChar
=
value
.
charCodeAt
(
k
);
nUnicode
=
AscCommon
.
decodeSurrogateChar
(
nCharCode
,
nTrailingChar
);
}
}
else
nUnicode
=
nCharCode
;
if
(
null
!=
nUnicode
)
{
var
Item
;
if
(
0x20
!==
nUnicode
&&
0xA0
!==
nUnicode
&&
0x2009
!==
nUnicode
)
{
Item
=
new
ParaText
();
Item
.
Set_CharCode
(
nUnicode
);
}
else
Item
=
new
ParaSpace
();
//add text
oCurRun
.
Add_ToContent
(
k
,
Item
,
false
);
}
}
},
InsertInPlacePresentation
:
function
(
aNewContent
)
InsertInPlacePresentation
:
function
(
aNewContent
)
{
{
var
presentation
=
editor
.
WordControl
.
m_oLogicDocument
;
var
presentation
=
editor
.
WordControl
.
m_oLogicDocument
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment