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
0d536c96
Commit
0d536c96
authored
Dec 15, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CreateRGBColor function
add SetBorders function
parent
1dbf67f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
14 deletions
+143
-14
cell/apiBuilder.js
cell/apiBuilder.js
+142
-12
common/apiCommon.js
common/apiCommon.js
+1
-2
No files found.
cell/apiBuilder.js
View file @
0d536c96
...
@@ -95,6 +95,24 @@
...
@@ -95,6 +95,24 @@
}
}
AscCommon
.
extendClass
(
ApiChart
,
ApiDrawing
);
AscCommon
.
extendClass
(
ApiChart
,
ApiDrawing
);
/**
* Class representing a base class for color types
* @constructor
*/
function
ApiColor
(
color
)
{
this
.
color
=
color
;
}
/**
* Class representing RGB color
* @constructor
*/
function
ApiRGBColor
(
r
,
g
,
b
)
{
ApiRGBColor
.
superclass
.
constructor
.
call
(
this
,
new
Asc
.
asc_CColor
(
r
,
g
,
b
));
}
AscCommon
.
extendClass
(
ApiRGBColor
,
ApiColor
);
/**
/**
* Returns an object that represents the active sheet
* Returns an object that represents the active sheet
* @memberof Api
* @memberof Api
...
@@ -109,6 +127,18 @@
...
@@ -109,6 +127,18 @@
History
.
Create_NewPoint
();
History
.
Create_NewPoint
();
};
};
/**
* Create a RGB color
* @memberof Api
* @param {byte} r
* @param {byte} g
* @param {byte} b
* @returns {ApiRGBColor}
*/
Api
.
prototype
.
CreateRGBColor
=
function
(
r
,
g
,
b
)
{
return
new
ApiRGBColor
(
r
,
g
,
b
);
};
/**
/**
* Returns an object that represents the active cell
* Returns an object that represents the active cell
* @memberof ApiWorksheet
* @memberof ApiWorksheet
...
@@ -391,6 +421,16 @@
...
@@ -391,6 +421,16 @@
return
new
ApiImage
(
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
));
return
new
ApiImage
(
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
));
};
};
/**
* Specifies the border to be retrieved.
* @typedef {("DiagonalDown" | "DiagonalUp" | "Bottom" | "Left" | "Right" | "Top" | "InsideHorizontal" | "InsideVertical")} BordersIndex
*/
/**
* Specifies the line style for the border.
* @typedef {("None" | "Double" | "Hair" | "DashDotDot" | "DashDot" | "Dotted" | "Dashed" | "Thin" | "MediumDashDotDot" | "SlantDashDot" | "MediumDashDot" | "MediumDashed" | "Medium" | "Thick")} LineStyle
*/
/**
/**
* Get cell row
* Get cell row
* @memberof ApiRange
* @memberof ApiRange
...
@@ -420,12 +460,10 @@
...
@@ -420,12 +460,10 @@
/**
/**
* Set text color in the rgb format.
* Set text color in the rgb format.
* @memberof ApiRange
* @memberof ApiRange
* @param {byte} r
* @param {ApiColor} color
* @param {byte} g
* @param {byte} b
*/
*/
ApiRange
.
prototype
.
SetFontColor
=
function
(
r
,
g
,
b
)
{
ApiRange
.
prototype
.
SetFontColor
=
function
(
color
)
{
this
.
range
.
setFontcolor
(
new
AscCommonExcel
.
RgbColor
((
r
<<
16
)
+
(
g
<<
8
)
+
b
));
this
.
range
.
setFontcolor
(
AscCommonExcel
.
CorrectAscColor
(
color
.
color
));
};
};
/**
/**
...
@@ -541,12 +579,10 @@
...
@@ -541,12 +579,10 @@
/**
/**
* Set fill color in the rgb format.
* Set fill color in the rgb format.
* @memberof ApiRange
* @memberof ApiRange
* @param {byte} r
* @param {ApiColor} color
* @param {byte} g
* @param {byte} b
*/
*/
ApiRange
.
prototype
.
SetFillColor
=
function
(
r
,
g
,
b
)
{
ApiRange
.
prototype
.
SetFillColor
=
function
(
color
)
{
this
.
range
.
setFill
(
new
AscCommonExcel
.
RgbColor
((
r
<<
16
)
+
(
g
<<
8
)
+
b
));
this
.
range
.
setFill
(
AscCommonExcel
.
CorrectAscColor
(
color
.
color
));
};
};
/**
/**
...
@@ -558,6 +594,46 @@
...
@@ -558,6 +594,46 @@
this
.
range
.
setNumFormat
(
value
);
this
.
range
.
setNumFormat
(
value
);
};
};
/**
* Set border properties.
* @memberof ApiRange
* @param {BordersIndex} bordersIndex
* @param {LineStyle} lineStyle
* @param {ApiColor} color
*/
ApiRange
.
prototype
.
SetBorders
=
function
(
bordersIndex
,
lineStyle
,
color
)
{
var
borders
=
new
AscCommonExcel
.
Border
();
switch
(
bordersIndex
)
{
case
'
DiagonalDown
'
:
borders
.
dd
=
true
;
borders
.
d
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
DiagonalUp
'
:
borders
.
du
=
true
;
borders
.
d
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
Bottom
'
:
borders
.
b
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
Left
'
:
borders
.
l
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
Right
'
:
borders
.
r
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
Top
'
:
borders
.
t
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
InsideHorizontal
'
:
borders
.
ih
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
case
'
InsideVertical
'
:
borders
.
iv
=
private_MakeBorder
(
lineStyle
,
color
);
break
;
}
this
.
range
.
setBorder
(
borders
);
};
/**
/**
* Creates a merged cell from the specified Range.
* Creates a merged cell from the specified Range.
* @memberof ApiRange
* @memberof ApiRange
...
@@ -583,8 +659,6 @@
...
@@ -583,8 +659,6 @@
};
};
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
//
//
// ApiDrawing
// ApiDrawing
...
@@ -790,6 +864,7 @@
...
@@ -790,6 +864,7 @@
Api
.
prototype
[
"
GetActiveSheet
"
]
=
Api
.
prototype
.
GetActiveSheet
;
Api
.
prototype
[
"
GetActiveSheet
"
]
=
Api
.
prototype
.
GetActiveSheet
;
Api
.
prototype
[
"
CreateNewHistoryPoint
"
]
=
Api
.
prototype
.
CreateNewHistoryPoint
;
Api
.
prototype
[
"
CreateNewHistoryPoint
"
]
=
Api
.
prototype
.
CreateNewHistoryPoint
;
Api
.
prototype
[
"
CreateRGBColor
"
]
=
Api
.
prototype
.
CreateRGBColor
;
ApiWorksheet
.
prototype
[
"
GetActiveCell
"
]
=
ApiWorksheet
.
prototype
.
GetActiveCell
;
ApiWorksheet
.
prototype
[
"
GetActiveCell
"
]
=
ApiWorksheet
.
prototype
.
GetActiveCell
;
ApiWorksheet
.
prototype
[
"
SetName
"
]
=
ApiWorksheet
.
prototype
.
SetName
;
ApiWorksheet
.
prototype
[
"
SetName
"
]
=
ApiWorksheet
.
prototype
.
SetName
;
...
@@ -817,6 +892,7 @@
...
@@ -817,6 +892,7 @@
ApiRange
.
prototype
[
"
SetStrikeout
"
]
=
ApiRange
.
prototype
.
SetStrikeout
;
ApiRange
.
prototype
[
"
SetStrikeout
"
]
=
ApiRange
.
prototype
.
SetStrikeout
;
ApiRange
.
prototype
[
"
SetFillColor
"
]
=
ApiRange
.
prototype
.
SetFillColor
;
ApiRange
.
prototype
[
"
SetFillColor
"
]
=
ApiRange
.
prototype
.
SetFillColor
;
ApiRange
.
prototype
[
"
SetNumberFormat
"
]
=
ApiRange
.
prototype
.
SetNumberFormat
;
ApiRange
.
prototype
[
"
SetNumberFormat
"
]
=
ApiRange
.
prototype
.
SetNumberFormat
;
ApiRange
.
prototype
[
"
SetBorders
"
]
=
ApiRange
.
prototype
.
SetBorders
;
ApiRange
.
prototype
[
"
Merge
"
]
=
ApiRange
.
prototype
.
Merge
;
ApiRange
.
prototype
[
"
Merge
"
]
=
ApiRange
.
prototype
.
Merge
;
ApiRange
.
prototype
[
"
UnMerge
"
]
=
ApiRange
.
prototype
.
UnMerge
;
ApiRange
.
prototype
[
"
UnMerge
"
]
=
ApiRange
.
prototype
.
UnMerge
;
...
@@ -855,4 +931,58 @@
...
@@ -855,4 +931,58 @@
oDrawing
.
setDrawingBaseExt
(
nExtX
/
36000.0
,
nExtY
/
36000.0
);
oDrawing
.
setDrawingBaseExt
(
nExtX
/
36000.0
,
nExtY
/
36000.0
);
}
}
function
private_MakeBorder
(
lineStyle
,
color
)
{
var
border
=
new
AscCommonExcel
.
BorderProp
();
switch
(
lineStyle
)
{
case
'
Double
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Double
);
break
;
case
'
Hair
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Hair
);
break
;
case
'
DashDotDot
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
DashDotDot
);
break
;
case
'
DashDot
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
DashDot
);
break
;
case
'
Dotted
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Dotted
);
break
;
case
'
Dashed
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Dashed
);
break
;
case
'
Thin
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Thin
);
break
;
case
'
MediumDashDotDot
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
MediumDashDotDot
);
break
;
case
'
SlantDashDot
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
SlantDashDot
);
break
;
case
'
MediumDashDot
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
MediumDashDot
);
break
;
case
'
MediumDashed
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
MediumDashed
);
break
;
case
'
Medium
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Medium
);
break
;
case
'
Thick
'
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
Thick
);
break
;
case
'
None
'
:
default
:
border
.
setStyle
(
AscCommon
.
c_oAscBorderStyles
.
None
);
break
;
}
if
(
color
)
{
border
.
c
=
AscCommonExcel
.
CorrectAscColor
(
color
);
}
return
border
;
}
}(
window
,
null
));
}(
window
,
null
));
common/apiCommon.js
View file @
0d536c96
...
@@ -925,8 +925,7 @@
...
@@ -925,8 +925,7 @@
}
}
return
this
.
hex
;
return
this
.
hex
;
},
asc_getColor
:
function
()
{
},
asc_getColor
:
function
()
{
var
ret
=
new
CColor
(
this
.
r
,
this
.
g
,
this
.
b
);
return
new
CColor
(
this
.
r
,
this
.
g
,
this
.
b
);
return
ret
;
},
asc_putAuto
:
function
(
v
)
{
},
asc_putAuto
:
function
(
v
)
{
this
.
Auto
=
v
;
this
.
Auto
=
v
;
},
asc_getAuto
:
function
()
{
},
asc_getAuto
:
function
()
{
...
...
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