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
67605397
Commit
67605397
authored
Apr 15, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправлены баги в билдере. В билдер добавлены функции для удаления колонтитула из заданной секции.
parent
b3e5d32f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
168 additions
and
14 deletions
+168
-14
word/Editor/Document.js
word/Editor/Document.js
+2
-2
word/Editor/Table.js
word/Editor/Table.js
+8
-5
word/apiBuilder.js
word/apiBuilder.js
+158
-7
No files found.
word/Editor/Document.js
View file @
67605397
...
...
@@ -11801,7 +11801,7 @@ CDocument.prototype =
return
this
.
Content
[
ContentPos
].
Get_NearestPos
(
ElementPageIndex
,
X
,
Y
,
bAnchor
,
Drawing
);
},
Internal_Content_Add
:
function
(
Position
,
NewObject
,
b
DoNotCheckLastElement
)
Internal_Content_Add
:
function
(
Position
,
NewObject
,
b
CheckTable
)
{
// Position = this.Content.length допускается
if
(
Position
<
0
||
Position
>
this
.
Content
.
length
)
...
...
@@ -11836,7 +11836,7 @@ CDocument.prototype =
this
.
Check_SectionLastParagraph
();
// Проверим, что последний элемент не таблица
if
(
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
()
&&
true
!==
bDoNotCheckLastElement
)
if
(
false
!=
bCheckTable
&&
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
()
)
this
.
Internal_Content_Add
(
this
.
Content
.
length
,
new
Paragraph
(
this
.
DrawingDocument
,
this
,
0
,
0
,
0
,
0
,
0
)
);
// Запоминаем, что нам нужно произвести переиндексацию элементов
...
...
word/Editor/Table.js
View file @
67605397
...
...
@@ -1153,10 +1153,13 @@ CTable.prototype =
// TableWidth (ширина таблицы)
if
(
undefined
!==
Props
.
TableWidth
)
{
if
(
null
===
Props
.
TableWidth
&&
tblwidth_Auto
!=
TablePr
.
TableW
.
Type
)
if
(
null
===
Props
.
TableWidth
)
{
this
.
Set_TableW
(
tblwidth_Auto
,
0
);
bRecalc_All
=
true
;
if
(
tblwidth_Auto
!=
TablePr
.
TableW
.
Type
)
{
this
.
Set_TableW
(
tblwidth_Auto
,
0
);
bRecalc_All
=
true
;
}
}
else
if
(
Props
.
TableWidth
>
-
0.001
)
{
...
...
@@ -1207,7 +1210,7 @@ CTable.prototype =
// TableAlignment (прилегание таблицы)
if
(
"
undefined
"
!=
typeof
(
Props
.
TableAlignment
)
&&
true
===
this
.
Is_Inline
()
)
{
var
NewJc
=
(
0
===
Props
.
TableAlignment
?
align_Left
:
(
1
===
Props
.
TableAlignment
?
AscCommon
.
align_Center
:
AscCommon
.
align_Right
)
);
var
NewJc
=
(
0
===
Props
.
TableAlignment
?
AscCommon
.
align_Left
:
(
1
===
Props
.
TableAlignment
?
AscCommon
.
align_Center
:
AscCommon
.
align_Right
)
);
if
(
TablePr
.
Jc
!=
NewJc
)
{
_Jc
=
NewJc
;
...
...
@@ -1217,7 +1220,7 @@ CTable.prototype =
}
// TableIndent (отступ слева)
if
(
"
undefined
"
!=
typeof
(
Props
.
TableIndent
)
&&
true
===
this
.
Is_Inline
()
&&
align_Left
===
_Jc
)
if
(
"
undefined
"
!=
typeof
(
Props
.
TableIndent
)
&&
true
===
this
.
Is_Inline
()
&&
AscCommon
.
align_Left
===
_Jc
)
{
if
(
Props
.
TableIndent
!=
TablePr
.
TableInd
)
{
...
...
word/apiBuilder.js
View file @
67605397
...
...
@@ -223,8 +223,8 @@
/**
* Create new table
* @method
* @param {number}
[nCols]
* @param {number}
[nRows]
* @param {number}
nCols
* @param {number}
nRows
* @returns {ApiTable}
*/
Api
.
prototype
.
CreateTable
=
function
(
nCols
,
nRows
)
...
...
@@ -277,7 +277,7 @@
{
if
(
oElement
instanceof
ApiParagraph
||
oElement
instanceof
ApiTable
)
{
this
.
Document
.
Internal_Content_Add
(
nPos
,
oElement
.
private_GetImpl
());
this
.
Document
.
Internal_Content_Add
(
nPos
,
oElement
.
private_GetImpl
()
,
false
);
return
true
;
}
...
...
@@ -410,6 +410,15 @@
oParagraph
.
private_GetImpl
().
Set_SectionPr
(
oSectPr
);
return
new
ApiSection
(
oSectPr
);
};
/**
* Specifies whether sections in this document shall have different headers and footers for even and odd pages
* (an odd page header/footer and an even page header/footer).
* @param {boolean} isEvenAndOdd
*/
ApiDocument
.
prototype
.
SetEvenAndOddHdrFtr
=
function
(
isEvenAndOdd
)
{
this
.
Document
.
Set_DocumentEvenAndOddHeaders
(
isEvenAndOdd
);
};
//------------------------------------------------------------------------------------------------------------------
//
...
...
@@ -1020,7 +1029,7 @@
};
/**
* Get the content for the specified type of header.
* @param {HdrFtrType} sType - Type of
the
header.
* @param {HdrFtrType} sType - Type of header.
* @param {boolean} [isCreate=false] - Create a header or not if there is no header with specified type in the current section.
* @returns {?ApiDocument}
*/
...
...
@@ -1051,9 +1060,24 @@
return
new
ApiDocument
(
oHeader
.
Get_DocumentContent
());
};
/**
* Remove a header of the specified type from the current section. After removing the header will be inherited from
* the previous section or, if this is the first section in the document, there won't be no header of the specified
* type.
* @param {HdrFtrType} sType - Type of header.
*/
ApiSection
.
prototype
.
RemoveHeader
=
function
(
sType
)
{
if
(
"
title
"
===
sType
)
this
.
Section
.
Set_Header_First
(
null
);
else
if
(
"
even
"
===
sType
)
this
.
Section
.
Set_Header_Even
(
null
);
else
if
(
"
default
"
===
sType
)
this
.
Section
.
Set_Header_Default
(
null
);
};
/**
* Get the content for the specified type of footer.
* @param {HdrFtrType} sType - Type of
the
footer.
* @param {HdrFtrType} sType - Type of footer.
* @param {boolean} [isCreate=false] - Create a footer or not if there is no footer with specified type in the current section.
* @returns {?ApiDocument}
*/
...
...
@@ -1070,7 +1094,7 @@
else
return
null
;
if
(
null
===
o
Head
er
&&
true
===
isCreate
)
if
(
null
===
o
Foot
er
&&
true
===
isCreate
)
{
var
oLogicDocument
=
private_GetLogicDocument
();
oFooter
=
new
CHeaderFooter
(
oLogicDocument
.
Get_HdrFtr
(),
oLogicDocument
,
oLogicDocument
.
Get_DrawingDocument
(),
hdrftr_Footer
);
...
...
@@ -1084,6 +1108,30 @@
return
new
ApiDocument
(
oFooter
.
Get_DocumentContent
());
};
/**
* Remove a footer of the specified type from the current section. After removing the footer will be inherited from
* the previous section or, if this is the first section in the document, there won't be no footer of the specified
* type.
* @param {HdrFtrType} sType - Type of footer.
*/
ApiSection
.
prototype
.
RemoveFooter
=
function
(
sType
)
{
if
(
"
title
"
===
sType
)
this
.
Section
.
Set_Footer_First
(
null
);
else
if
(
"
even
"
===
sType
)
this
.
Section
.
Set_Footer_Even
(
null
);
else
if
(
"
default
"
===
sType
)
this
.
Section
.
Set_Footer_Default
(
null
);
};
/**
* Specifies whether the current section in this document shall have a different header and footer for its first
* page.
* @param {boolean} isTitlePage
*/
ApiSection
.
prototype
.
SetTitlePage
=
function
(
isTitlePage
)
{
this
.
Section
.
Set_TitlePage
(
private_GetBoolean
(
isTitlePage
));
};
//------------------------------------------------------------------------------------------------------------------
//
...
...
@@ -1179,7 +1227,7 @@
/**
* Set the preferred width for this table.
* @param {("auto" | "twips" | "percent" | "nil")} sType - Type of the width value
* @param {number}
nValue
* @param {number}
[nValue]
*/
ApiTable
.
prototype
.
SetWidth
=
function
(
sType
,
nValue
)
{
...
...
@@ -1190,6 +1238,19 @@
else
if
(
"
percent
"
===
sType
)
this
.
Table
.
Set_Props
({
TableWidth
:
-
nValue
});
};
/**
* Set the alignment of the current table with respect to the text margins in the current section.
* @param {("left" | "right" | "center")} sJcType
*/
ApiTable
.
prototype
.
SetJc
=
function
(
sJcType
)
{
if
(
"
left
"
===
sJcType
)
this
.
Table
.
Set_Props
({
TableAlignment
:
0
});
else
if
(
"
right
"
===
sJcType
)
this
.
Table
.
Set_Props
({
TableAlignment
:
2
});
else
if
(
"
center
"
===
sJcType
)
this
.
Table
.
Set_Props
({
TableAlignment
:
1
});
};
/**
* Specify the components of the conditional formatting of the referenced table style (if one exists)
* which shall be applied to the set of table rows with the current table-level property exceptions. A table style can
...
...
@@ -1962,6 +2023,7 @@
ApiDocument
.
prototype
[
"
GetDefaultStyle
"
]
=
ApiDocument
.
prototype
.
GetDefaultStyle
;
ApiDocument
.
prototype
[
"
GetFinalSection
"
]
=
ApiDocument
.
prototype
.
GetFinalSection
;
ApiDocument
.
prototype
[
"
CreateSection
"
]
=
ApiDocument
.
prototype
.
CreateSection
;
ApiDocument
.
prototype
[
"
SetEvenAndOddHdrFtr
"
]
=
ApiDocument
.
prototype
.
SetEvenAndOddHdrFtr
;
ApiParagraph
.
prototype
[
"
AddText
"
]
=
ApiParagraph
.
prototype
.
AddText
;
ApiParagraph
.
prototype
[
"
AddPageBreak
"
]
=
ApiParagraph
.
prototype
.
AddPageBreak
;
...
...
@@ -2017,6 +2079,11 @@
ApiSection
.
prototype
[
"
SetPageMargins
"
]
=
ApiSection
.
prototype
.
SetPageMargins
;
ApiSection
.
prototype
[
"
SetHeaderDistance
"
]
=
ApiSection
.
prototype
.
SetHeaderDistance
;
ApiSection
.
prototype
[
"
SetFooterDistance
"
]
=
ApiSection
.
prototype
.
SetFooterDistance
;
ApiSection
.
prototype
[
"
GetHeader
"
]
=
ApiSection
.
prototype
.
GetHeader
;
ApiSection
.
prototype
[
"
RemoveHeader
"
]
=
ApiSection
.
prototype
.
RemoveHeader
;
ApiSection
.
prototype
[
"
GetFooter
"
]
=
ApiSection
.
prototype
.
GetFooter
;
ApiSection
.
prototype
[
"
RemoveFooter
"
]
=
ApiSection
.
prototype
.
RemoveFooter
;
ApiSection
.
prototype
[
"
SetTitlePage
"
]
=
ApiSection
.
prototype
.
SetTitlePage
;
ApiTable
.
prototype
[
"
GetRowsCount
"
]
=
ApiTable
.
prototype
.
GetRowsCount
;
ApiTable
.
prototype
[
"
GetRow
"
]
=
ApiTable
.
prototype
.
GetRow
;
...
...
@@ -2659,7 +2726,91 @@ function TEST_BUILDER()
oParagraph
=
Api
.
CreateParagraph
();
oDocument
.
Push
(
oParagraph
);
oTextPr
=
oParagraph
.
GetParagraphMarkTextPr
();
oTextPr
.
SetColor
(
0xff
,
0x00
,
0x00
);
oTextPr
.
SetFontFamily
(
"
Segoe UI
"
);
// Filling ups header and footer
oSection1
.
SetTitlePage
(
true
);
var
oDocContent
=
oSection1
.
GetHeader
(
"
default
"
,
true
);
oDocContent
.
RemoveAllElements
();
oTable
=
Api
.
CreateTable
(
2
,
1
);
oDocContent
.
Push
(
oTable
);
oTable
.
SetWidth
(
"
auto
"
);
oTable
.
SetJc
(
"
right
"
);
oTable
.
SetTableLook
(
true
,
true
,
false
,
false
,
true
,
false
);
oRow
=
oTable
.
GetRow
(
0
);
if
(
oRow
)
{
oRow
.
SetHeight
(
"
atLeast
"
,
792
);
oCell
=
oRow
.
GetCell
(
0
);
if
(
oCell
)
{
oCell
.
SetWidth
(
"
twips
"
,
3337
);
oCell
.
SetVerticalAlign
(
"
bottom
"
);
oCellContent
=
oCell
.
GetContent
();
oParagraph
=
oCellContent
.
GetElement
(
0
);
oParagraph
.
SetStyle
(
"
Header
"
);
oParagraph
.
SetJc
(
"
right
"
);
oTextPr
=
oParagraph
.
GetParagraphMarkTextPr
();
oTextPr
.
SetFontFamily
(
"
Calibri Light
"
);
oTextPr
.
SetFontSize
(
28
);
oRun
=
oParagraph
.
AddText
(
"
HAYDEN MANAGEMENT
"
);
oRun
.
SetSmallCaps
(
true
);
oRun
.
SetFontSize
(
32
);
oRun
.
SetFontFamily
(
"
Calibri Light
"
);
}
oCell
=
oRow
.
GetCell
(
1
);
if
(
oCell
)
{
oCell
.
SetWidth
(
"
twips
"
,
792
);
oCell
.
SetShd
(
"
clear
"
,
0xff
,
0xa4
,
0x65
);
oCell
.
SetVerticalAlign
(
"
center
"
);
oCellContent
=
oCell
.
GetContent
();
oParagraph
=
oCellContent
.
GetElement
(
0
);
oParagraph
.
SetStyle
(
"
Header
"
);
oParagraph
.
SetJc
(
"
center
"
);
oParagraph
.
GetParagraphMarkTextPr
().
SetColor
(
0xff
,
0xff
,
0xff
);
oRun
=
oParagraph
.
AddText
(
"
1
"
);
oRun
.
SetColor
(
0xff
,
0xff
,
0xff
);
}
}
oParagraph
=
Api
.
CreateParagraph
();
oDocContent
.
Push
(
oParagraph
);
oDocContent
=
oSection1
.
GetFooter
(
"
default
"
,
true
);
oDocContent
.
RemoveAllElements
();
oTable
=
Api
.
CreateTable
(
2
,
1
);
oDocContent
.
Push
(
oTable
);
oTable
.
SetWidth
(
"
auto
"
);
oTable
.
SetJc
(
"
right
"
);
oTable
.
SetTableLook
(
true
,
true
,
false
,
false
,
true
,
false
);
oRow
=
oTable
.
GetRow
(
0
);
if
(
oRow
)
{
oCell
=
oRow
.
GetCell
(
0
);
if
(
oCell
)
{
oCell
.
SetWidth
(
"
auto
"
);
oCellContent
=
oCell
.
GetContent
();
oParagraph
=
oCellContent
.
GetElement
(
0
);
oParagraph
.
SetStyle
(
"
Footer
"
);
oParagraph
.
SetJc
(
"
right
"
);
oParagraph
.
AddText
(
"
Hayden Management
"
);
oParagraph
.
AddText
(
"
| Confidential
"
);
}
oCell
=
oRow
.
GetCell
(
1
);
if
(
oCell
)
{
oCell
.
SetWidth
(
"
auto
"
);
oCellContent
=
oCell
.
GetContent
();
oParagraph
=
oCellContent
.
GetElement
(
0
);
oParagraph
.
SetStyle
(
"
Footer
"
);
oParagraph
.
SetJc
(
"
right
"
);
// TODO: Добавить автофигуру
}
}
//------------------------------------------------------------------------------------------------------------------
oLD
.
Recalculate_FromStart
(
true
);
...
...
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