Skip to content

Issue with Gradients #1720

@ccx004B

Description

@ccx004B

I found another odd thing ImportExcel when creating and copying gradient settings in a cell. The following code demonstrates this:
`
$XL = Open-ExcelPackage -Path "example.xlsx" -Create
$Sheet = Add-WorkSheet -ExcelPackage $XL -WorksheetName "Example"

$Sheet.Cells["A1"].Style.Fill.Gradient | gm | ft

$Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Setcolor("BLUE")
$Sheet.Cells["A1"].Style.Fill.Gradient.Color2.Setcolor("GREEN")

write-host "RGB= " $Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Rgb
write-host "Top= " $Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Top
write-host "Bot= " $Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Bottom
write-host "Lef= " $Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Left
write-host "Rig= " $Sheet.Cells["A1"].Style.Fill.Gradient.Color1.Right

Close-ExcelPackage -ExcelPackage $XL -Show
`

Running this will create a blank spreadsheet with one cell (A1) filled with a gradient going from Blue to Green. However, reading back the values that have been set gives nothing as shown by the 4 write-host commands. I have checked all the other properties of "Style.Fill.Gradient" and they are all NULL or blank. This means it is not possible to copy gradients from one set of cells to another but perhaps there is some other way.

Any thoughts would be appreciated.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions