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
aa107858
Commit
aa107858
authored
Apr 15, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
В билдер добавлена возможность работать с колонтитулами.
parent
01b3ed5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
word/apiBuilder.js
word/apiBuilder.js
+77
-0
No files found.
word/apiBuilder.js
View file @
aa107858
...
...
@@ -191,6 +191,11 @@
* @typedef {number} pt
*/
/**
* Header and footer types
* @typedef {("default" | "title" | "even")} HdrFtrType
*/
//------------------------------------------------------------------------------------------------------------------
//
// Base Api
...
...
@@ -1013,6 +1018,72 @@
{
this
.
Section
.
Set_PageMargins_Footer
(
private_Twips2MM
(
nDistance
));
};
/**
* Get the content for the specified type of header.
* @param {HdrFtrType} sType - Type of the header.
* @param {boolean} [isCreate=false] - Create a header or not if there is no header with specified type in the current section.
* @returns {?ApiDocument}
*/
ApiSection
.
prototype
.
GetHeader
=
function
(
sType
,
isCreate
)
{
var
oHeader
=
null
;
if
(
"
title
"
===
sType
)
oHeader
=
this
.
Section
.
Get_Header_First
();
else
if
(
"
even
"
===
sType
)
oHeader
=
this
.
Section
.
Get_Header_Even
();
else
if
(
"
default
"
===
sType
)
oHeader
=
this
.
Section
.
Get_Header_Default
();
else
return
null
;
if
(
null
===
oHeader
&&
true
===
isCreate
)
{
var
oLogicDocument
=
private_GetLogicDocument
();
oHeader
=
new
CHeaderFooter
(
oLogicDocument
.
Get_HdrFtr
(),
oLogicDocument
,
oLogicDocument
.
Get_DrawingDocument
(),
hdrftr_Header
);
if
(
"
title
"
===
sType
)
this
.
Section
.
Set_Header_First
(
oHeader
);
else
if
(
"
even
"
===
sType
)
this
.
Section
.
Set_Header_Even
(
oHeader
);
else
if
(
"
default
"
===
sType
)
this
.
Section
.
Set_Header_Default
(
oHeader
);
}
return
new
ApiDocument
(
oHeader
.
Get_DocumentContent
());
};
/**
* Get the content for the specified type of footer.
* @param {HdrFtrType} sType - Type of the footer.
* @param {boolean} [isCreate=false] - Create a footer or not if there is no footer with specified type in the current section.
* @returns {?ApiDocument}
*/
ApiSection
.
prototype
.
GetFooter
=
function
(
sType
,
isCreate
)
{
var
oFooter
=
null
;
if
(
"
title
"
===
sType
)
oFooter
=
this
.
Section
.
Get_Footer_First
();
else
if
(
"
even
"
===
sType
)
oFooter
=
this
.
Section
.
Get_Footer_Even
();
else
if
(
"
default
"
===
sType
)
oFooter
=
this
.
Section
.
Get_Footer_Default
();
else
return
null
;
if
(
null
===
oHeader
&&
true
===
isCreate
)
{
var
oLogicDocument
=
private_GetLogicDocument
();
oFooter
=
new
CHeaderFooter
(
oLogicDocument
.
Get_HdrFtr
(),
oLogicDocument
,
oLogicDocument
.
Get_DrawingDocument
(),
hdrftr_Footer
);
if
(
"
title
"
===
sType
)
this
.
Section
.
Set_Footer_First
(
oFooter
);
else
if
(
"
even
"
===
sType
)
this
.
Section
.
Set_Footer_Even
(
oFooter
);
else
if
(
"
default
"
===
sType
)
this
.
Section
.
Set_Footer_Default
(
oFooter
);
}
return
new
ApiDocument
(
oFooter
.
Get_DocumentContent
());
};
//------------------------------------------------------------------------------------------------------------------
//
...
...
@@ -2746,6 +2817,12 @@ function TEST_BUILDER2()
//TODO: Сделать примеры параграфов с нумерацей
var
oSection
=
oDocument
.
GetFinalSection
();
var
oHeader
=
oSection
.
GetHeader
(
"
default
"
,
true
);
oParagraph
=
oHeader
.
GetElement
(
0
);
oParagraph
.
AddText
(
"
I'm in default header
"
);
//------------------------------------------------------------------------------------------------------------------
oLD
.
Recalculate_FromStart
();
}
...
...
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