Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docxtemplater-image-module
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
npm
docxtemplater-image-module
Commits
41ea55c4
Commit
41ea55c4
authored
Feb 17, 2015
by
Edgar Hipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using xmlTemplater.tagxml instead of constants that match 'w:t' (for
future powerpoint compatibility)
parent
11ad3d7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
coffee/index.coffee
+6
-4
No files found.
coffee/index.coffee
View file @
41ea55c4
...
@@ -42,11 +42,13 @@ class ImageModule
...
@@ -42,11 +42,13 @@ class ImageModule
tag
=
templaterState
.
textInsideTag
.
substr
(
1
)
tag
=
templaterState
.
textInsideTag
.
substr
(
1
)
imgData
=
scopeManager
.
getValueFromScope
(
tag
)
imgData
=
scopeManager
.
getValueFromScope
(
tag
)
if
imgData
==
'undefined'
then
return
@
replaceBy
(
'<w:t></w:t>'
,
'w:t'
)
tagXml
=
@
manager
.
getInstance
(
'xmlTemplater'
).
tagXml
startEnd
=
"<
#{
tagXml
}
></
#{
tagXml
}
>"
if
imgData
==
'undefined'
then
return
@
replaceBy
(
startEnd
,
tagXml
)
try
try
imgBuffer
=
@
getImageFromData
(
imgData
)
imgBuffer
=
@
getImageFromData
(
imgData
)
catch
e
catch
e
return
@
replaceBy
(
'<w:t></w:t>'
,
'w:t'
)
return
@
replaceBy
(
startEnd
,
tagXml
)
rId
=
@
imgManager
rId
=
@
imgManager
.
loadImageRels
()
.
loadImageRels
()
.
addImageRels
(
@
getNextImageName
(),
imgBuffer
)
.
addImageRels
(
@
getNextImageName
(),
imgBuffer
)
...
@@ -55,10 +57,10 @@ class ImageModule
...
@@ -55,10 +57,10 @@ class ImageModule
size
=
[
@
convertPixelsToEmus
(
sizePixel
[
0
]),
@
convertPixelsToEmus
(
sizePixel
[
1
])]
size
=
[
@
convertPixelsToEmus
(
sizePixel
[
0
]),
@
convertPixelsToEmus
(
sizePixel
[
1
])]
if
@
options
.
centered
==
false
if
@
options
.
centered
==
false
outsideElement
=
'w:t'
outsideElement
=
tagXml
newText
=
@
getImageXml
(
rId
,
size
)
newText
=
@
getImageXml
(
rId
,
size
)
if
@
options
.
centered
==
true
if
@
options
.
centered
==
true
outsideElement
=
'w
:p'
outsideElement
=
tagXml
.
substr
(
0
,
1
)
+
'
:p'
newText
=
@
getImageXmlCentered
(
rId
,
size
)
newText
=
@
getImageXmlCentered
(
rId
,
size
)
@
replaceBy
(
newText
,
outsideElement
)
@
replaceBy
(
newText
,
outsideElement
)
...
...
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