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
700d62f8
Commit
700d62f8
authored
Mar 31, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Пернес fitToWidth и fitToHeight в PagePrintOptions
parent
1906aba4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
339 additions
and
364 deletions
+339
-364
cell/api.js
cell/api.js
+35
-32
cell/apiDefines.js
cell/apiDefines.js
+24
-29
cell/native/native.js
cell/native/native.js
+2
-1
cell/utils/utils.js
cell/utils/utils.js
+37
-62
cell/view/WorkbookView.js
cell/view/WorkbookView.js
+11
-9
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+230
-231
No files found.
cell/api.js
View file @
700d62f8
...
@@ -3184,11 +3184,14 @@ var editor;
...
@@ -3184,11 +3184,14 @@ var editor;
var
_adjustPrint
=
window
.
AscDesktopEditor_PrintData
?
window
.
AscDesktopEditor_PrintData
:
new
asc_CAdjustPrint
();
var
_adjustPrint
=
window
.
AscDesktopEditor_PrintData
?
window
.
AscDesktopEditor_PrintData
:
new
asc_CAdjustPrint
();
window
.
AscDesktopEditor_PrintData
=
undefined
;
window
.
AscDesktopEditor_PrintData
=
undefined
;
if
(
1
==
_param
)
if
(
1
==
_param
)
{
{
var
countWorksheets
=
_adjustPrint
.
asc_setPrintType
(
c_oAscPrintType
.
EntireWorkbook
),
printOptions
;
_adjustPrint
.
asc_setPrintType
(
c_oAscPrintType
.
EntireWorkbook
);
this
.
wbModel
.
getWorksheetCount
();
_adjustPrint
.
asc_setFitToWidth
(
true
);
for
(
var
j
=
0
;
j
<
countWorksheets
;
++
j
)
{
_adjustPrint
.
asc_setFitToHeight
(
true
);
printOptions
=
this
.
wbModel
.
getWorksheet
(
j
).
PagePrintOptions
;
printOptions
.
asc_setFitToWidth
(
true
);
printOptions
.
asc_setFitToHeight
(
true
);
}
}
}
var
_printPagesData
=
this
.
wb
.
calcPagesPrint
(
_adjustPrint
);
var
_printPagesData
=
this
.
wb
.
calcPagesPrint
(
_adjustPrint
);
...
...
cell/apiDefines.js
View file @
700d62f8
...
@@ -251,11 +251,6 @@ var c_oAscPrintType = {
...
@@ -251,11 +251,6 @@ var c_oAscPrintType = {
EntireWorkbook
:
1
,
// Всю книгу
EntireWorkbook
:
1
,
// Всю книгу
Selection
:
2
// Выделенный фрагмент
Selection
:
2
// Выделенный фрагмент
};
};
// Тип печати
var
c_oAscLayoutPageType
=
{
FitToWidth
:
0
,
// На всю ширину
ActualSize
:
1
// По реальным размерам
};
/** @enum */
/** @enum */
var
c_oAscCustomAutoFilter
=
{
var
c_oAscCustomAutoFilter
=
{
...
...
cell/native/native.js
View file @
700d62f8
...
@@ -2352,7 +2352,8 @@ function asc_ReadAdjustPrint(s, p) {
...
@@ -2352,7 +2352,8 @@ function asc_ReadAdjustPrint(s, p) {
}
}
case
1
:
case
1
:
{
{
adjustPrint
.
asc_setLayoutPageType
(
s
[
p
.
pos
++
]);
// ToDo что-то тут нужно поправить...Теперь нет asc_setLayoutPageType
//adjustPrint.asc_setLayoutPageType(s[p.pos++]);
break
;
break
;
}
}
case
255
:
case
255
:
...
...
cell/utils/utils.js
View file @
700d62f8
...
@@ -1079,33 +1079,26 @@
...
@@ -1079,33 +1079,26 @@
asc_CPageMargins
.
prototype
.
asc_setTop
=
function
(
val
)
{
this
.
top
=
val
;
};
asc_CPageMargins
.
prototype
.
asc_setTop
=
function
(
val
)
{
this
.
top
=
val
;
};
asc_CPageMargins
.
prototype
.
asc_setBottom
=
function
(
val
)
{
this
.
bottom
=
val
;
};
asc_CPageMargins
.
prototype
.
asc_setBottom
=
function
(
val
)
{
this
.
bottom
=
val
;
};
/** @constructor */
/** @constructor */
function
asc_CPageSetup
(
obj
)
{
function
asc_CPageSetup
()
{
if
(
!
(
this
instanceof
asc_CPageSetup
)
)
{
this
.
orientation
=
c_oAscPrintDefaultSettings
.
PageOrientation
;
return
new
asc_CPageSetup
(
obj
)
;
this
.
width
=
c_oAscPrintDefaultSettings
.
PageWidth
;
}
this
.
height
=
c_oAscPrintDefaultSettings
.
PageHeight
;
if
(
obj
)
{
this
.
fitToWidth
=
false
;
//ToDo can be a number
this
.
orientation
=
obj
.
orientation
;
this
.
fitToHeight
=
false
;
//ToDo can be a number
this
.
width
=
obj
.
width
;
this
.
height
=
obj
.
height
;
}
return
this
;
return
this
;
}
}
asc_CPageSetup
.
prototype
.
init
=
function
()
{
if
(
null
==
this
.
orientation
)
this
.
orientation
=
c_oAscPrintDefaultSettings
.
PageOrientation
;
if
(
null
==
this
.
width
)
this
.
width
=
c_oAscPrintDefaultSettings
.
PageWidth
;
if
(
null
==
this
.
height
)
this
.
height
=
c_oAscPrintDefaultSettings
.
PageHeight
;
};
asc_CPageSetup
.
prototype
.
asc_getOrientation
=
function
()
{
return
this
.
orientation
;
};
asc_CPageSetup
.
prototype
.
asc_getOrientation
=
function
()
{
return
this
.
orientation
;
};
asc_CPageSetup
.
prototype
.
asc_getWidth
=
function
()
{
return
this
.
width
;
};
asc_CPageSetup
.
prototype
.
asc_getWidth
=
function
()
{
return
this
.
width
;
};
asc_CPageSetup
.
prototype
.
asc_getHeight
=
function
()
{
return
this
.
height
;
};
asc_CPageSetup
.
prototype
.
asc_getHeight
=
function
()
{
return
this
.
height
;
};
asc_CPageSetup
.
prototype
.
asc_setOrientation
=
function
(
val
)
{
this
.
orientation
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setOrientation
=
function
(
val
)
{
this
.
orientation
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setWidth
=
function
(
val
)
{
this
.
width
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setWidth
=
function
(
val
)
{
this
.
width
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setHeight
=
function
(
val
)
{
this
.
height
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setHeight
=
function
(
val
)
{
this
.
height
=
val
;
};
asc_CPageSetup
.
prototype
.
getFitToWidth
=
function
()
{
return
this
.
fitToWidth
;
};
asc_CPageSetup
.
prototype
.
getFitToHeight
=
function
()
{
return
this
.
fitToHeight
;
};
asc_CPageSetup
.
prototype
.
asc_setFitToWidth
=
function
(
val
)
{
this
.
fitToWidth
=
val
;
};
asc_CPageSetup
.
prototype
.
asc_setFitToHeight
=
function
(
val
)
{
this
.
fitToHeight
=
val
;
};
/** @constructor */
/** @constructor */
function
asc_CPageOptions
(
obj
)
{
function
asc_CPageOptions
(
obj
)
{
...
@@ -1186,30 +1179,14 @@
...
@@ -1186,30 +1179,14 @@
}
}
/** @constructor */
/** @constructor */
function
asc_CAdjustPrint
()
{
function
asc_CAdjustPrint
()
{
if
(
!
(
this
instanceof
asc_CAdjustPrint
)
)
{
return
new
asc_CAdjustPrint
();
}
// Вид печати
// Вид печати
this
.
printType
=
c_oAscPrintType
.
ActiveSheets
;
this
.
printType
=
c_oAscPrintType
.
ActiveSheets
;
// Вид печати
// ToDo сюда же start и end page index
this
.
layoutPageType
=
c_oAscLayoutPageType
.
ActualSize
;
// По ширине
this
.
fitToWidth
=
false
;
// По высоте
this
.
fitToHeight
=
false
;
return
this
;
return
this
;
}
}
asc_CAdjustPrint
.
prototype
.
asc_getPrintType
=
function
()
{
return
this
.
printType
;
};
asc_CAdjustPrint
.
prototype
.
asc_getPrintType
=
function
()
{
return
this
.
printType
;
};
asc_CAdjustPrint
.
prototype
.
asc_getLayoutPageType
=
function
()
{
return
this
.
layoutPageType
;
};
asc_CAdjustPrint
.
prototype
.
asc_setPrintType
=
function
(
val
)
{
this
.
printType
=
val
;
};
asc_CAdjustPrint
.
prototype
.
asc_setPrintType
=
function
(
val
)
{
this
.
printType
=
val
;
};
asc_CAdjustPrint
.
prototype
.
asc_setLayoutPageType
=
function
(
val
)
{
this
.
layoutPageType
=
val
;
};
asc_CAdjustPrint
.
prototype
.
getFitToWidth
=
function
()
{
return
this
.
fitToWidth
;
};
asc_CAdjustPrint
.
prototype
.
getFitToHeight
=
function
()
{
return
this
.
fitToHeight
;
};
asc_CAdjustPrint
.
prototype
.
asc_setFitToWidth
=
function
(
val
)
{
this
.
fitToWidth
=
val
;
};
asc_CAdjustPrint
.
prototype
.
asc_setFitToHeight
=
function
(
val
)
{
this
.
fitToHeight
=
val
;
};
/** @constructor */
/** @constructor */
function
asc_CLockInfo
()
{
function
asc_CLockInfo
()
{
...
@@ -1688,6 +1665,8 @@
...
@@ -1688,6 +1665,8 @@
prot
[
"
asc_setOrientation
"
]
=
prot
.
asc_setOrientation
;
prot
[
"
asc_setOrientation
"
]
=
prot
.
asc_setOrientation
;
prot
[
"
asc_setWidth
"
]
=
prot
.
asc_setWidth
;
prot
[
"
asc_setWidth
"
]
=
prot
.
asc_setWidth
;
prot
[
"
asc_setHeight
"
]
=
prot
.
asc_setHeight
;
prot
[
"
asc_setHeight
"
]
=
prot
.
asc_setHeight
;
prot
[
"
asc_setFitToWidth
"
]
=
prot
.
asc_setFitToWidth
;
prot
[
"
asc_setFitToHeight
"
]
=
prot
.
asc_setFitToHeight
;
window
[
"
Asc
"
][
"
asc_CPageOptions
"
]
=
window
[
"
Asc
"
].
asc_CPageOptions
=
asc_CPageOptions
;
window
[
"
Asc
"
][
"
asc_CPageOptions
"
]
=
window
[
"
Asc
"
].
asc_CPageOptions
=
asc_CPageOptions
;
prot
=
asc_CPageOptions
.
prototype
;
prot
=
asc_CPageOptions
.
prototype
;
...
@@ -1706,11 +1685,7 @@
...
@@ -1706,11 +1685,7 @@
window
[
"
Asc
"
][
"
asc_CAdjustPrint
"
]
=
window
[
"
Asc
"
].
asc_CAdjustPrint
=
asc_CAdjustPrint
;
window
[
"
Asc
"
][
"
asc_CAdjustPrint
"
]
=
window
[
"
Asc
"
].
asc_CAdjustPrint
=
asc_CAdjustPrint
;
prot
=
asc_CAdjustPrint
.
prototype
;
prot
=
asc_CAdjustPrint
.
prototype
;
prot
[
"
asc_getPrintType
"
]
=
prot
.
asc_getPrintType
;
prot
[
"
asc_getPrintType
"
]
=
prot
.
asc_getPrintType
;
prot
[
"
asc_getLayoutPageType
"
]
=
prot
.
asc_getLayoutPageType
;
prot
[
"
asc_setPrintType
"
]
=
prot
.
asc_setPrintType
;
prot
[
"
asc_setPrintType
"
]
=
prot
.
asc_setPrintType
;
prot
[
"
asc_setLayoutPageType
"
]
=
prot
.
asc_setLayoutPageType
;
prot
[
"
asc_setFitToWidth
"
]
=
prot
.
asc_setFitToWidth
;
prot
[
"
asc_setFitToHeight
"
]
=
prot
.
asc_setFitToHeight
;
window
[
"
Asc
"
].
asc_CLockInfo
=
asc_CLockInfo
;
window
[
"
Asc
"
].
asc_CLockInfo
=
asc_CLockInfo
;
...
...
cell/view/WorkbookView.js
View file @
700d62f8
...
@@ -2387,19 +2387,19 @@
...
@@ -2387,19 +2387,19 @@
var
activeWs
;
var
activeWs
;
var
printPagesData
=
new
asc_CPrintPagesData
();
var
printPagesData
=
new
asc_CPrintPagesData
();
var
printType
=
adjustPrint
.
asc_getPrintType
();
var
printType
=
adjustPrint
.
asc_getPrintType
();
// var layoutPageType = adjustPrint.asc_getLayoutPageType();
if
(
printType
===
c_oAscPrintType
.
ActiveSheets
)
{
var
bFitToWidth
=
adjustPrint
.
getFitToWidth
();
var
bFitToHeight
=
adjustPrint
.
getFitToHeight
();
if
(
printType
==
c_oAscPrintType
.
ActiveSheets
)
{
activeWs
=
wb
.
getActive
();
activeWs
=
wb
.
getActive
();
ws
=
this
.
getWorksheet
();
ws
=
this
.
getWorksheet
();
printPagesData
.
arrPages
=
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
activeWs
).
PagePrintOptions
,
/*printOnlySelection*/
false
,
/*indexWorksheet*/
activeWs
,
bFitToWidth
,
bFitToHeight
);
printPagesData
.
arrPages
=
}
else
if
(
printType
==
c_oAscPrintType
.
EntireWorkbook
)
{
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
activeWs
).
PagePrintOptions
,
/*printOnlySelection*/
false
,
/*indexWorksheet*/
activeWs
);
}
else
if
(
printType
===
c_oAscPrintType
.
EntireWorkbook
)
{
// Колличество листов
// Колличество листов
var
countWorksheets
=
this
.
model
.
getWorksheetCount
();
var
countWorksheets
=
this
.
model
.
getWorksheetCount
();
for
(
var
i
=
0
;
i
<
countWorksheets
;
++
i
)
{
for
(
var
i
=
0
;
i
<
countWorksheets
;
++
i
)
{
ws
=
this
.
getWorksheet
(
i
);
ws
=
this
.
getWorksheet
(
i
);
var
arrPages
=
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
i
).
PagePrintOptions
,
/*printOnlySelection*/
false
,
/*indexWorksheet*/
i
,
bFitToWidth
,
bFitToHeight
);
var
arrPages
=
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
i
).
PagePrintOptions
,
/*printOnlySelection*/
false
,
/*indexWorksheet*/
i
);
if
(
null
!==
arrPages
)
{
if
(
null
!==
arrPages
)
{
if
(
null
===
printPagesData
.
arrPages
)
{
if
(
null
===
printPagesData
.
arrPages
)
{
printPagesData
.
arrPages
=
[];
printPagesData
.
arrPages
=
[];
...
@@ -2407,10 +2407,12 @@
...
@@ -2407,10 +2407,12 @@
printPagesData
.
arrPages
=
printPagesData
.
arrPages
.
concat
(
arrPages
);
printPagesData
.
arrPages
=
printPagesData
.
arrPages
.
concat
(
arrPages
);
}
}
}
}
}
else
if
(
printType
==
c_oAscPrintType
.
Selection
)
{
}
else
if
(
printType
==
=
c_oAscPrintType
.
Selection
)
{
activeWs
=
wb
.
getActive
();
activeWs
=
wb
.
getActive
();
ws
=
this
.
getWorksheet
();
ws
=
this
.
getWorksheet
();
printPagesData
.
arrPages
=
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
activeWs
).
PagePrintOptions
,
/*printOnlySelection*/
true
,
/*indexWorksheet*/
activeWs
,
bFitToWidth
,
bFitToHeight
);
printPagesData
.
arrPages
=
ws
.
calcPagesPrint
(
wb
.
getWorksheet
(
activeWs
).
PagePrintOptions
,
/*printOnlySelection*/
true
,
/*indexWorksheet*/
activeWs
);
}
}
return
printPagesData
;
return
printPagesData
;
...
...
cell/view/WorksheetView.js
View file @
700d62f8
...
@@ -1631,29 +1631,31 @@
...
@@ -1631,29 +1631,31 @@
};
};
// ----- Drawing for print -----
// ----- Drawing for print -----
WorksheetView
.
prototype
.
calcPagesPrint
=
function
(
pageOptions
,
printOnlySelection
,
indexWorksheet
,
bFitToWidth
,
bFitToHeigh
t
)
{
WorksheetView
.
prototype
.
calcPagesPrint
=
function
(
pageOptions
,
printOnlySelection
,
indexWorkshee
t
)
{
var
range
;
var
range
;
var
maxCols
=
this
.
model
.
getColsCount
();
var
maxCols
=
this
.
model
.
getColsCount
();
var
maxRows
=
this
.
model
.
getRowsCount
();
var
maxRows
=
this
.
model
.
getRowsCount
();
var
lastC
=
-
1
,
lastR
=
-
1
;
var
lastC
=
-
1
,
lastR
=
-
1
;
var
activeRange
=
printOnlySelection
?
this
.
activeRange
:
null
;
var
activeRange
=
printOnlySelection
?
this
.
activeRange
:
null
;
var
bFitToWidth
=
pageOptions
.
getFitToWidth
();
if
(
null
===
activeRange
)
{
var
bFitToHeight
=
pageOptions
.
getFitToHeight
();
range
=
new
asc_Range
(
0
,
0
,
maxCols
,
maxRows
);
this
.
_prepareCellTextMetricsCache
(
range
);
if
(
null
===
activeRange
)
{
for
(
var
c
=
0
;
c
<
maxCols
;
++
c
)
{
range
=
new
asc_Range
(
0
,
0
,
maxCols
,
maxRows
);
for
(
var
r
=
0
;
r
<
maxRows
;
++
r
)
{
this
.
_prepareCellTextMetricsCache
(
range
);
if
(
!
this
.
_isCellEmptyOrMergedOrBackgroundColorOrBorders
(
c
,
r
)
)
{
for
(
var
c
=
0
;
c
<
maxCols
;
++
c
)
{
for
(
var
r
=
0
;
r
<
maxRows
;
++
r
)
{
if
(
!
this
.
_isCellEmptyOrMergedOrBackgroundColorOrBorders
(
c
,
r
))
{
var
rightSide
=
0
;
var
rightSide
=
0
;
var
ct
=
this
.
_getCellTextCache
(
c
,
r
);
var
ct
=
this
.
_getCellTextCache
(
c
,
r
);
if
(
ct
!==
undefined
)
{
if
(
ct
!==
undefined
)
{
if
(
!
ct
.
flags
.
isMerged
()
&&
!
ct
.
flags
.
wrapText
)
{
if
(
!
ct
.
flags
.
isMerged
()
&&
!
ct
.
flags
.
wrapText
)
{
rightSide
=
ct
.
sideR
;
rightSide
=
ct
.
sideR
;
}
}
}
}
lastC
=
Math
.
max
(
lastC
,
c
+
rightSide
);
lastC
=
Math
.
max
(
lastC
,
c
+
rightSide
);
lastR
=
Math
.
max
(
lastR
,
r
);
lastR
=
Math
.
max
(
lastR
,
r
);
}
}
}
}
}
}
...
@@ -1662,20 +1664,19 @@
...
@@ -1662,20 +1664,19 @@
// Получаем максимальную колонку/строку для изображений/чатов
// Получаем максимальную колонку/строку для изображений/чатов
var
maxObjectsCoord
=
this
.
objectRender
.
getDrawingAreaMetrics
();
var
maxObjectsCoord
=
this
.
objectRender
.
getDrawingAreaMetrics
();
if
(
maxObjectsCoord
)
{
if
(
maxObjectsCoord
)
{
maxCols
=
Math
.
max
(
maxCols
,
maxObjectsCoord
.
maxCol
);
maxCols
=
Math
.
max
(
maxCols
,
maxObjectsCoord
.
maxCol
);
maxRows
=
Math
.
max
(
maxRows
,
maxObjectsCoord
.
maxRow
);
maxRows
=
Math
.
max
(
maxRows
,
maxObjectsCoord
.
maxRow
);
}
}
}
else
{
}
else
{
maxCols
=
activeRange
.
c2
+
1
;
maxCols
=
activeRange
.
c2
+
1
;
maxRows
=
activeRange
.
r2
+
1
;
maxRows
=
activeRange
.
r2
+
1
;
range
=
new
asc_Range
(
0
,
0
,
maxCols
,
maxRows
);
range
=
new
asc_Range
(
0
,
0
,
maxCols
,
maxRows
);
this
.
_prepareCellTextMetricsCache
(
range
);
this
.
_prepareCellTextMetricsCache
(
range
);
}
}
var
pageMargins
,
pageSetup
,
pageGridLines
,
pageHeadings
;
var
pageMargins
,
pageSetup
,
pageGridLines
,
pageHeadings
;
if
(
pageOptions
instanceof
asc_CPageOptions
)
{
if
(
pageOptions
instanceof
asc_CPageOptions
)
{
pageMargins
=
pageOptions
.
asc_getPageMargins
();
pageMargins
=
pageOptions
.
asc_getPageMargins
();
pageSetup
=
pageOptions
.
asc_getPageSetup
();
pageSetup
=
pageOptions
.
asc_getPageSetup
();
pageGridLines
=
pageOptions
.
asc_getGridLines
();
pageGridLines
=
pageOptions
.
asc_getGridLines
();
...
@@ -1683,62 +1684,61 @@
...
@@ -1683,62 +1684,61 @@
}
}
var
pageWidth
,
pageHeight
,
pageOrientation
;
var
pageWidth
,
pageHeight
,
pageOrientation
;
if
(
pageSetup
instanceof
asc_CPageSetup
)
{
if
(
pageSetup
instanceof
asc_CPageSetup
)
{
pageWidth
=
pageSetup
.
asc_getWidth
();
pageWidth
=
pageSetup
.
asc_getWidth
();
pageHeight
=
pageSetup
.
asc_getHeight
();
pageHeight
=
pageSetup
.
asc_getHeight
();
pageOrientation
=
pageSetup
.
asc_getOrientation
();
pageOrientation
=
pageSetup
.
asc_getOrientation
();
}
}
var
pageLeftField
,
pageRightField
,
pageTopField
,
pageBottomField
;
var
pageLeftField
,
pageRightField
,
pageTopField
,
pageBottomField
;
if
(
pageMargins
instanceof
asc_CPageMargins
)
{
if
(
pageMargins
instanceof
asc_CPageMargins
)
{
pageLeftField
=
pageMargins
.
asc_getLeft
();
pageLeftField
=
pageMargins
.
asc_getLeft
();
pageRightField
=
pageMargins
.
asc_getRight
();
pageRightField
=
pageMargins
.
asc_getRight
();
pageTopField
=
pageMargins
.
asc_getTop
();
pageTopField
=
pageMargins
.
asc_getTop
();
pageBottomField
=
pageMargins
.
asc_getBottom
();
pageBottomField
=
pageMargins
.
asc_getBottom
();
}
}
if
(
null
==
pageGridLines
)
{
if
(
null
==
pageGridLines
)
{
pageGridLines
=
c_oAscPrintDefaultSettings
.
PageGridLines
;
pageGridLines
=
c_oAscPrintDefaultSettings
.
PageGridLines
;
}
}
if
(
null
==
pageHeadings
)
{
if
(
null
==
pageHeadings
)
{
pageHeadings
=
c_oAscPrintDefaultSettings
.
PageHeadings
;
pageHeadings
=
c_oAscPrintDefaultSettings
.
PageHeadings
;
}
}
if
(
null
==
pageWidth
)
{
if
(
null
==
pageWidth
)
{
pageWidth
=
c_oAscPrintDefaultSettings
.
PageWidth
;
pageWidth
=
c_oAscPrintDefaultSettings
.
PageWidth
;
}
}
if
(
null
==
pageHeight
)
{
if
(
null
==
pageHeight
)
{
pageHeight
=
c_oAscPrintDefaultSettings
.
PageHeight
;
pageHeight
=
c_oAscPrintDefaultSettings
.
PageHeight
;
}
}
if
(
null
==
pageOrientation
)
{
if
(
null
==
pageOrientation
)
{
pageOrientation
=
c_oAscPrintDefaultSettings
.
PageOrientation
;
pageOrientation
=
c_oAscPrintDefaultSettings
.
PageOrientation
;
}
}
if
(
null
==
pageLeftField
)
{
if
(
null
==
pageLeftField
)
{
pageLeftField
=
c_oAscPrintDefaultSettings
.
PageLeftField
;
pageLeftField
=
c_oAscPrintDefaultSettings
.
PageLeftField
;
}
}
if
(
null
==
pageRightField
)
{
if
(
null
==
pageRightField
)
{
pageRightField
=
c_oAscPrintDefaultSettings
.
PageRightField
;
pageRightField
=
c_oAscPrintDefaultSettings
.
PageRightField
;
}
}
if
(
null
==
pageTopField
)
{
if
(
null
==
pageTopField
)
{
pageTopField
=
c_oAscPrintDefaultSettings
.
PageTopField
;
pageTopField
=
c_oAscPrintDefaultSettings
.
PageTopField
;
}
}
if
(
null
==
pageBottomField
)
{
if
(
null
==
pageBottomField
)
{
pageBottomField
=
c_oAscPrintDefaultSettings
.
PageBottomField
;
pageBottomField
=
c_oAscPrintDefaultSettings
.
PageBottomField
;
}
}
if
(
c_oAscPageOrientation
.
PageLandscape
===
pageOrientation
)
{
if
(
c_oAscPageOrientation
.
PageLandscape
===
pageOrientation
)
{
var
tmp
=
pageWidth
;
var
tmp
=
pageWidth
;
pageWidth
=
pageHeight
;
pageWidth
=
pageHeight
;
pageHeight
=
tmp
;
pageHeight
=
tmp
;
}
}
var
arrResult
=
[];
var
arrResult
=
[];
if
(
0
===
maxCols
||
0
===
maxRows
)
{
if
(
0
===
maxCols
||
0
===
maxRows
)
{
// Ничего нет, возвращаем пустой массив
// Ничего нет, возвращаем пустой массив
return
null
;
return
null
;
}
}
else
{
else
{
var
pageWidthWithFields
=
pageWidth
-
pageLeftField
-
pageRightField
;
var
pageWidthWithFields
=
pageWidth
-
pageLeftField
-
pageRightField
;
var
pageHeightWithFields
=
pageHeight
-
pageTopField
-
pageBottomField
;
var
pageHeightWithFields
=
pageHeight
-
pageTopField
-
pageBottomField
;
var
leftFieldInPt
=
pageLeftField
/
vector_koef
;
var
leftFieldInPt
=
pageLeftField
/
vector_koef
;
...
@@ -1746,7 +1746,7 @@
...
@@ -1746,7 +1746,7 @@
var
rightFieldInPt
=
pageRightField
/
vector_koef
;
var
rightFieldInPt
=
pageRightField
/
vector_koef
;
var
bottomFieldInPt
=
pageBottomField
/
vector_koef
;
var
bottomFieldInPt
=
pageBottomField
/
vector_koef
;
if
(
pageHeadings
)
{
if
(
pageHeadings
)
{
// Рисуем заголовки, нужно чуть сдвинуться
// Рисуем заголовки, нужно чуть сдвинуться
leftFieldInPt
+=
this
.
cellsLeft
;
leftFieldInPt
+=
this
.
cellsLeft
;
topFieldInPt
+=
this
.
cellsTop
;
topFieldInPt
+=
this
.
cellsTop
;
...
@@ -1764,8 +1764,8 @@
...
@@ -1764,8 +1764,8 @@
var
bIsAddOffset
=
false
;
var
bIsAddOffset
=
false
;
var
nCountOffset
=
0
;
var
nCountOffset
=
0
;
while
(
true
)
{
while
(
true
)
{
if
(
currentColIndex
===
maxCols
&&
currentRowIndex
===
maxRows
)
{
if
(
currentColIndex
===
maxCols
&&
currentRowIndex
===
maxRows
)
{
break
;
break
;
}
}
...
@@ -1787,48 +1787,49 @@
...
@@ -1787,48 +1787,49 @@
newPagePrint
.
rightFieldInPt
=
rightFieldInPt
;
newPagePrint
.
rightFieldInPt
=
rightFieldInPt
;
newPagePrint
.
bottomFieldInPt
=
bottomFieldInPt
;
newPagePrint
.
bottomFieldInPt
=
bottomFieldInPt
;
for
(
rowIndex
=
currentRowIndex
;
rowIndex
<
maxRows
;
++
rowIndex
)
{
for
(
rowIndex
=
currentRowIndex
;
rowIndex
<
maxRows
;
++
rowIndex
)
{
var
currentRowHeight
=
this
.
rows
[
rowIndex
].
height
;
var
currentRowHeight
=
this
.
rows
[
rowIndex
].
height
;
if
(
!
bFitToHeight
&&
currentHeight
+
currentRowHeight
>
pageHeightWithFieldsHeadings
)
{
if
(
!
bFitToHeight
&&
currentHeight
+
currentRowHeight
>
pageHeightWithFieldsHeadings
)
{
// Закончили рисовать страницу
// Закончили рисовать страницу
break
;
break
;
}
}
if
(
isCalcColumnsWidth
)
{
if
(
isCalcColumnsWidth
)
{
for
(
colIndex
=
currentColIndex
;
colIndex
<
maxCols
;
++
colIndex
)
{
for
(
colIndex
=
currentColIndex
;
colIndex
<
maxCols
;
++
colIndex
)
{
var
currentColWidth
=
this
.
cols
[
colIndex
].
width
;
var
currentColWidth
=
this
.
cols
[
colIndex
].
width
;
if
(
bIsAddOffset
)
{
if
(
bIsAddOffset
)
{
newPagePrint
.
startOffset
=
++
nCountOffset
;
newPagePrint
.
startOffset
=
++
nCountOffset
;
newPagePrint
.
startOffsetPt
=
(
pageWidthWithFieldsHeadings
*
newPagePrint
.
startOffset
);
newPagePrint
.
startOffsetPt
=
(
pageWidthWithFieldsHeadings
*
newPagePrint
.
startOffset
);
currentColWidth
-=
newPagePrint
.
startOffsetPt
;
currentColWidth
-=
newPagePrint
.
startOffsetPt
;
}
}
if
(
!
bFitToWidth
&&
currentWidth
+
currentColWidth
>
pageWidthWithFieldsHeadings
&&
colIndex
!==
currentColIndex
)
{
if
(
!
bFitToWidth
&&
currentWidth
+
currentColWidth
>
pageWidthWithFieldsHeadings
&&
colIndex
!==
currentColIndex
)
{
break
;
break
;
}
}
currentWidth
+=
currentColWidth
;
currentWidth
+=
currentColWidth
;
if
(
!
bFitToWidth
&&
currentWidth
>
pageWidthWithFieldsHeadings
&&
colIndex
===
currentColIndex
)
{
if
(
!
bFitToWidth
&&
currentWidth
>
pageWidthWithFieldsHeadings
&&
colIndex
===
currentColIndex
)
{
// Смещаем в селедующий раз ячейку
// Смещаем в селедующий раз ячейку
bIsAddOffset
=
true
;
bIsAddOffset
=
true
;
++
colIndex
;
++
colIndex
;
break
;
break
;
}
}
else
{
else
{
bIsAddOffset
=
false
;
bIsAddOffset
=
false
;
}
}
}
}
isCalcColumnsWidth
=
false
;
isCalcColumnsWidth
=
false
;
if
(
pageHeadings
)
{
if
(
pageHeadings
)
{
currentWidth
+=
this
.
cellsLeft
;
currentWidth
+=
this
.
cellsLeft
;
}
}
if
(
bFitToWidth
)
{
if
(
bFitToWidth
)
{
newPagePrint
.
pageClipRectWidth
=
Math
.
max
(
currentWidth
,
newPagePrint
.
pageClipRectWidth
);
newPagePrint
.
pageClipRectWidth
=
Math
.
max
(
currentWidth
,
newPagePrint
.
pageClipRectWidth
);
newPagePrint
.
pageWidth
=
newPagePrint
.
pageClipRectWidth
*
vector_koef
+
(
pageLeftField
+
pageRightField
);
newPagePrint
.
pageWidth
=
}
newPagePrint
.
pageClipRectWidth
*
vector_koef
+
(
pageLeftField
+
pageRightField
);
else
{
}
else
{
newPagePrint
.
pageClipRectWidth
=
Math
.
min
(
currentWidth
,
newPagePrint
.
pageClipRectWidth
);
newPagePrint
.
pageClipRectWidth
=
Math
.
min
(
currentWidth
,
newPagePrint
.
pageClipRectWidth
);
}
}
}
}
...
@@ -1838,58 +1839,56 @@
...
@@ -1838,58 +1839,56 @@
if
(
bFitToHeight
)
{
if
(
bFitToHeight
)
{
newPagePrint
.
pageClipRectHeight
=
Math
.
max
(
currentHeight
,
newPagePrint
.
pageClipRectHeight
);
newPagePrint
.
pageClipRectHeight
=
Math
.
max
(
currentHeight
,
newPagePrint
.
pageClipRectHeight
);
newPagePrint
.
pageHeight
=
newPagePrint
.
pageClipRectHeight
*
vector_koef
+
(
pageTopField
+
pageBottomField
);
newPagePrint
.
pageHeight
=
newPagePrint
.
pageClipRectHeight
*
vector_koef
+
(
pageTopField
+
pageBottomField
);
}
}
// Нужно будет пересчитывать колонки
// Нужно будет пересчитывать колонки
isCalcColumnsWidth
=
true
;
isCalcColumnsWidth
=
true
;
// Рисуем сетку
// Рисуем сетку
if
(
pageGridLines
)
{
if
(
pageGridLines
)
{
newPagePrint
.
pageGridLines
=
true
;
newPagePrint
.
pageGridLines
=
true
;
}
}
if
(
pageHeadings
)
{
if
(
pageHeadings
)
{
// Нужно отрисовать заголовки
// Нужно отрисовать заголовки
newPagePrint
.
pageHeadings
=
true
;
newPagePrint
.
pageHeadings
=
true
;
}
}
newPagePrint
.
pageRange
=
new
asc_Range
(
currentColIndex
,
currentRowIndex
,
colIndex
-
1
,
rowIndex
-
1
);
newPagePrint
.
pageRange
=
new
asc_Range
(
currentColIndex
,
currentRowIndex
,
colIndex
-
1
,
rowIndex
-
1
);
if
(
bIsAddOffset
)
{
if
(
bIsAddOffset
)
{
// Мы еще не дорисовали колонку
// Мы еще не дорисовали колонку
colIndex
-=
1
;
colIndex
-=
1
;
}
}
else
{
else
{
nCountOffset
=
0
;
nCountOffset
=
0
;
}
}
if
(
colIndex
<
maxCols
)
{
if
(
colIndex
<
maxCols
)
{
// Мы еще не все колонки отрисовали
// Мы еще не все колонки отрисовали
currentColIndex
=
colIndex
;
currentColIndex
=
colIndex
;
currentHeight
=
0
;
currentHeight
=
0
;
}
}
else
{
else
{
// Мы дорисовали все колонки, нужна новая строка и стартовая колонка
// Мы дорисовали все колонки, нужна новая строка и стартовая колонка
currentColIndex
=
(
null
!==
activeRange
)
?
activeRange
.
c1
:
0
;
currentColIndex
=
(
null
!==
activeRange
)
?
activeRange
.
c1
:
0
;
currentRowIndex
=
rowIndex
;
currentRowIndex
=
rowIndex
;
currentHeight
=
0
;
currentHeight
=
0
;
}
}
if
(
rowIndex
===
maxRows
)
{
if
(
rowIndex
===
maxRows
)
{
// Мы вышли, т.к. дошли до конца отрисовки по строкам
// Мы вышли, т.к. дошли до конца отрисовки по строкам
if
(
colIndex
<
maxCols
)
{
if
(
colIndex
<
maxCols
)
{
currentColIndex
=
colIndex
;
currentColIndex
=
colIndex
;
currentHeight
=
0
;
currentHeight
=
0
;
}
}
else
{
else
{
// Мы дошли до конца отрисовки
// Мы дошли до конца отрисовки
currentColIndex
=
colIndex
;
currentColIndex
=
colIndex
;
currentRowIndex
=
rowIndex
;
currentRowIndex
=
rowIndex
;
}
}
}
}
arrResult
.
push
(
newPagePrint
);
arrResult
.
push
(
newPagePrint
);
}
}
}
}
...
...
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