Skip to content

Commit 91f5560

Browse files
committed
ACI0105520: Fix cell background color when converting to picture if explicitly set to no color
+ use var declarations
1 parent 9408b44 commit 91f5560

File tree

3 files changed

+91
-129
lines changed

3 files changed

+91
-129
lines changed

Project/Sources/Methods/VP Convert to picture.4dm

Lines changed: 49 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,30 @@
44
err_TRY
55

66
// MARK:- Declaration
7-
C_OBJECT:C1216($sheets; $table; $cell; $style)
8-
C_TEXT:C284($svgSource)
9-
C_TEXT:C284($svgRef)
10-
C_TEXT:C284($elemRef)
11-
C_LONGINT:C283($iterX; $iterY; $svgHeight; $svgWidth; $x1; $x2; $y1; $y2; $height; $width)
12-
C_LONGINT:C283($defaultColWidth; $defaultRowHeight; $initialColWidth; $initialRowHeight)
137
ARRAY LONGINT:C221($colPos; 0)
148
ARRAY LONGINT:C221($rowPos; 0)
15-
C_REAL:C285($colWidth; $rowHeight)
16-
C_OBJECT:C1216($lineObj)
17-
C_OBJECT:C1216($obj)
18-
C_BOOLEAN:C305($displayValue)
19-
C_LONGINT:C283($pos)
20-
C_OBJECT:C1216($defaultStyle)
21-
C_COLLECTION:C1488($valCol)
22-
C_LONGINT:C283($rightOverflow; $leftOverflow)
23-
C_REAL:C285($pictWidth; $pictHeight)
24-
C_REAL:C285($pictX; $pictY)
25-
C_TEXT:C284($shrinkStr)
26-
C_TEXT:C284($defaultFontSize; $fontSize)
27-
C_LONGINT:C283($textWidth)
28-
C_LONGINT:C283($i)
29-
C_BOOLEAN:C305($visible; $condition)
30-
C_OBJECT:C1216($namedStyle)
31-
C_OBJECT:C1216($workbook)
32-
C_COLLECTION:C1488($namedStyleCol)
33-
C_LONGINT:C283($index)
34-
C_BOOLEAN:C305($cascadingStyleSheet)
35-
C_COLLECTION:C1488($sheetCol)
36-
C_TEXT:C284($s)
37-
C_TEXT:C284($valueStr)
38-
C_COLLECTION:C1488($bgImgCol)
39-
C_OBJECT:C1216($strPart)
40-
C_TEXT:C284($defaultGridLineColor)
41-
C_OBJECT:C1216($parsedStyle)
42-
C_COLLECTION:C1488($namedStyleQuery)
43-
C_BOOLEAN:C305($borderOrientation)
44-
C_REAL:C285($borderOffset)
45-
C_BOOLEAN:C305($drawLine)
46-
C_LONGINT:C283($indexColWidth; $indexRowHeight)
47-
C_OBJECT:C1216($bcObj)
48-
C_LONGINT:C283($rowCount; $colCount)
49-
C_LONGINT:C283($maxSvgWidth; $maxSvgHeight)
9+
10+
var $sheets; $table; $cell; $style : Object
11+
var $lineObj; $obj; $defaultStyle : Object
12+
var $namedStyle; $workbook; $parsedStyle; $bcObj : Object
13+
var $strPart : Object
14+
var $svgSource; $svgRef; $elemRef : Text
15+
var $shrinkStr; $defaultFontSize; $fontSize; $valueStr; $defaultGridLineColor : Text
16+
17+
var $textWidth; $i; $index; $indexColWidth; $indexRowHeight; $rowCount; $colCount; $maxSvgWidth; $maxSvgHeight : Integer
18+
var $iterX; $iterY; $svgHeight; $svgWidth; $x1; $x2; $y1; $y2; $height; $width : Integer
19+
var $defaultColWidth; $defaultRowHeight; $initialColWidth; $initialRowHeight : Integer
20+
var $rightOverflow; $leftOverflow : Integer
21+
var $pos : Integer
22+
23+
var $colWidth; $rowHeight : Real
24+
var $borderOffset : Real
25+
var $pictWidth; $pictHeight : Real
26+
var $pictX; $pictY : Real
27+
28+
var $valCol; $namedStyleCol; $sheetCol; $namedStyleQuery; $bgImgCol : Collection
29+
var $visible; $condition; $cascadingStyleSheet; $borderOrientation; $drawLine; $displayValue : Boolean
30+
5031

5132
// MARK:- Initialize Objects and Constants
5233
$bcObj:=New object:C1471("bcGrid"; New object:C1471; "bcCol"; New collection:C1472)
@@ -216,9 +197,9 @@ If ($range.y2>=$rowCount)
216197
End if
217198

218199
// MARK:- Row and Column Positions
219-
C_LONGINT:C283($size)
200+
var $size : Integer
220201

221-
C_LONGINT:C283($startY)
202+
var $startY : Integer
222203
$startY:=0
223204
For ($iterY; 0; $range.y1-1)
224205

@@ -305,7 +286,7 @@ Case of
305286
$svgHeight:=$svgHeight-$size
306287
End case
307288

308-
C_LONGINT:C283($startX)
289+
var $startX : Integer
309290
$startX:=0
310291
For ($iterX; 0; $range.x1-1)
311292

@@ -419,9 +400,9 @@ Else
419400
End if
420401

421402
///SPANS HANDLING///
422-
C_COLLECTION:C1488($mergeTab)
423-
C_OBJECT:C1216($span; $cellMergeStatus)
424-
C_LONGINT:C283($row; $col)
403+
var $mergeTab : Collection
404+
var $span; $cellMergeStatus : Object
405+
var $row; $col : Integer
425406

426407
$mergeTab:=Null:C1517
427408
If ($sheets#Null:C1517)
@@ -1079,10 +1060,10 @@ End if
10791060
$parsedStyle.vAlign:=TOP_VERTICAL_ALIGN
10801061
End if
10811062

1082-
C_REAL:C285($spaceWidth)
1063+
var $spaceWidth : Real
10831064

10841065
If ($parsedStyle.textOrientation#0) & ($parsedStyle.textOrientation#NONE_TEXT_ORIENTATION)
1085-
C_REAL:C285($lineHeight)
1066+
var $lineHeight : Real
10861067

10871068
$lineHeight:=DEFAULT_LINE_HEIGHT
10881069

@@ -1092,11 +1073,10 @@ End if
10921073
End if
10931074
End if
10941075

1095-
C_REAL:C285($radOrientation)
1096-
1076+
var $radOrientation : Real
10971077
$radOrientation:=Abs:C99($parsedStyle.textOrientation*Degree:K30:2)
10981078

1099-
C_OBJECT:C1216($initialBox; $rotatedBox; $translatedBox)
1079+
var $initialBox; $rotatedBox; $translatedBox : Object
11001080

11011081
$initialBox:=svg_getTextBox($x1; $y2; 10; $lineHeight)
11021082
$rotatedBox:=svg_getRotatedBox($initialBox; $initialBox.topLeft.x; $initialBox.topLeft.y; $radOrientation)
@@ -1111,16 +1091,13 @@ End if
11111091
: ($parsedStyle.formatInfo=Null:C1517)
11121092
Case of
11131093
: (Value type:C1509($cell.value)=Is real:K8:4) & ($parsedStyle.isVerticalText#1)
1114-
C_REAL:C285($e)
1115-
C_REAL:C285($p)
1116-
C_LONGINT:C283($nbU; $epos)
1117-
C_TEXT:C284($cvStr)
1118-
C_TEXT:C284($intPart)
1119-
C_TEXT:C284($decPart)
1120-
C_COLLECTION:C1488($cvCol)
1121-
C_LONGINT:C283($intLen; $decLen)
1122-
C_REAL:C285($x; $v)
1094+
var $e; $p : Real
1095+
var $nbU; $epos : Integer
1096+
var $cvCol : Collection
1097+
var $intLen; $decLen : Integer
1098+
var $x; $v : Real
11231099

1100+
var $cvStr; $intPart; $decPart : Text
11241101
$cvStr:=String:C10($cell.value)
11251102
If ($cell.value>=10000000000000)
11261103
$intPart:=$cvStr[[1]]
@@ -1295,17 +1272,17 @@ End if
12951272
End if
12961273

12971274
: (Value type:C1509($parsedStyle.formatInfo.content)=Is collection:K8:32)
1298-
C_REAL:C285($w)
1299-
C_REAL:C285($c)
1300-
C_OBJECT:C1216($valPart)
13011275

1302-
C_TEXT:C284($str)
1276+
1277+
var $str : Text
13031278
$str:=""
1279+
var $valPart : Object
13041280
For each ($valPart; $parsedStyle.formatInfo.content)
13051281
If ($valPart.type#"fillingChar") && ($valPart.type#"placeHolder") && ($valPart.type#"numberPlaceholder")
13061282
$str:=$str+$valPart.value
13071283
End if
13081284
End for each
1285+
var $w : Real
13091286
$w:=svg_getTextWidth($str; $parsedStyle.fontObj)
13101287

13111288
Case of
@@ -1319,13 +1296,12 @@ End if
13191296
Else
13201297

13211298
If ($w>(Int:C8($spaceWidth)-3))
1299+
var $c : Real
13221300
$c:=svg_getTextWidth("#"; $parsedStyle.fontObj)
13231301

13241302
$valueStr:="#"*Int:C8(((Int:C8($spaceWidth)-3)/$c))
13251303
Else
1326-
C_LONGINT:C283($nbC)
1327-
C_TEXT:C284($fc)
1328-
1304+
var $fc : Text
13291305
$fc:=$parsedStyle.formatInfo.content.query("type = fillingChar")[0].value
13301306

13311307
If ($fc=" ")
@@ -1334,6 +1310,7 @@ End if
13341310

13351311
$c:=svg_getTextWidth($fc; $parsedStyle.fontObj)
13361312

1313+
var $nbC : Integer
13371314
If (($parsedStyle.textOrientation#0) & ($parsedStyle.textOrientation#NONE_TEXT_ORIENTATION))
13381315
$nbC:=Int:C8((Int:C8($rowHeight)-3-$w)/$c)
13391316
Else
@@ -1670,8 +1647,7 @@ If ($sheets.floatingObjects#Null:C1517)
16701647
$width:=$obj.width
16711648
$height:=$obj.height
16721649

1673-
C_TEXT:C284($name)
1674-
1650+
var $name : Text
16751651
$name:=Replace string:C233($obj.name; " "; "_")
16761652

16771653
$elemRef:=DOM Create XML element:C865($svgRef; "/svg/clipPath"; "id"; $name)
@@ -1686,9 +1662,9 @@ If ($sheets.floatingObjects#Null:C1517)
16861662
$svgWidth:=$x1+$Width
16871663
End if
16881664

1689-
C_TEXT:C284($layout; $src)
1690-
//C_LONGINT($pictWidth;$pictHeight;$pictX;$pictY)
1665+
//var $pictWidth; $pictHeight; $pictX; $pictY: Integer
16911666

1667+
var $src : Text
16921668
$src:=$obj.src
16931669

16941670
svg_getPictSize(->$src; ->$pictWidth; ->$pictHeight)
@@ -1710,7 +1686,7 @@ If ($sheets.floatingObjects#Null:C1517)
17101686

17111687
End case
17121688

1713-
1689+
var $layout : Text
17141690
Case of
17151691
: ($obj.pictureStretch=Null:C1517)
17161692
$layout:="none"
Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
//%attributes = {"invisible":true,"preemptive":"capable"}
2-
C_OBJECT:C1216($1;$bcObj)
3-
C_LONGINT:C283($2;$iterX;$3;$iterY;$4;$x1;$5;$y1;$6;$width;$7;$height;$9;$offset)
4-
C_TEXT:C284($8;$color)
5-
C_BOOLEAN:C305($10;$isOriented)
6-
7-
C_BOOLEAN:C305($sameLeftColor)
8-
C_LONGINT:C283($ref)
9-
C_TEXT:C284($sIterX;$sIterY;$sIterXm)
10-
11-
$bcObj:=$1
12-
$iterX:=$2
13-
$iterY:=$3
14-
$x1:=$4
15-
$y1:=$5
16-
$width:=$6
17-
$height:=$7
18-
$color:=$8
19-
$offset:=$9
20-
$isOriented:=$10
2+
#DECLARE($bcObj : Object; $iterX : Integer; $iterY : Integer; $x1 : Integer; $y1 : Integer; $width : Integer; $height : Integer; $color : Text; $offset : Integer; $isOriented : Boolean)
213

4+
var $sIterX; $sIterY : Text
225
$sIterX:=String:C10($iterX)
236
$sIterY:=String:C10($iterY)
247

@@ -27,27 +10,35 @@ If ($bcObj.bcGrid[$sIterY]=Null:C1517)
2710
End if
2811

2912
If ($bcObj.bcGrid[$sIterY][$sIterX]=Null:C1517)
30-
$bcObj.bcGrid[$sIterY][$sIterX]:=New object:C1471("col";$color;"isOriented";$isOriented;"offset";$offset)
13+
$bcObj.bcGrid[$sIterY][$sIterX]:=New object:C1471("col"; $color; "isOriented"; $isOriented; "offset"; $offset)
3114
End if
3215

16+
If ($color="$4D_NOCOLOR")
17+
return
18+
End if
19+
20+
var $sameLeftColor : Boolean
3321
$sameLeftColor:=False:C215
3422

23+
var $sIterXm : Text
3524
$sIterXm:=String:C10($iterX-1)
3625

26+
var $ref : Integer
3727
Case of
3828
: ($iterX=0)
3929
: ($bcObj.bcGrid[$sIterY]=Null:C1517)
4030
: ($bcObj.bcGrid[$sIterY][$sIterXm]=Null:C1517)
41-
: ($bcObj.bcGrid[$sIterY][$sIterXm].col=$color) & (Not:C34($bcObj.bcGrid[$sIterY][$sIterXm].isOriented))
31+
: ($bcObj.bcGrid[$sIterY][$sIterXm].col=$color) && (Not:C34($bcObj.bcGrid[$sIterY][$sIterXm].isOriented))
4232
$sameLeftColor:=True:C214
4333
$ref:=$bcObj.bcGrid[$sIterY][$sIterXm].ref
4434
$bcObj.bcGrid[$sIterY][$sIterX].ref:=$ref
4535
$bcObj.bcCol[$ref].w:=$bcObj.bcCol[$ref].w+$width
4636
End case
4737

4838
If (Not:C34($sameLeftColor))
39+
4940
$ref:=$bcObj.bcCol.length
5041
$bcObj.bcGrid[$sIterY][$sIterX].ref:=$ref
51-
$bcObj.bcCol[$ref]:=New object:C1471("x";$x1;"y";$y1;"w";$width;"h";$height;"c";$color;"isOriented";$isOriented;"offset";$offset)
42+
$bcObj.bcCol[$ref]:=New object:C1471("x"; $x1; "y"; $y1; "w"; $width; "h"; $height; "c"; $color; "isOriented"; $isOriented; "offset"; $offset)
5243

5344
End if

0 commit comments

Comments
 (0)