LibreOffice Calc のセル内文字下線一覧を PowerShell プログラムで表示します。
# セル文字下線.ps1
Set-StrictMode -Version latest
Add-Type -Path (Join-Path $PSScriptRoot "./CalcAuto.dll")
$sCalcFile = $PSScriptRoot + "\calcTest1.ods" # 開くCalc ファイル名
$libOffice = New-Object CalcAuto.LibreOffice
$libCalcd = $libOffice.calcOpen($sCalcFile)
$sheets = $libCalcd.sheets
$sheets.insertNewByName("下線一覧", $sheets.getCount()) # 最後にシート追加
$sheet = $sheets.getByName("下線一覧")
$libCalcd.getCurrentController().setActiveSheet($sheet)
$arcolor = [System.Drawing.Color]::Red.ToArgb(),
[System.Drawing.Color]::Lime.ToArgb(),
[System.Drawing.Color]::Blue.ToArgb()
$iy = 0; $ic = 0
foreach($cline in [CalcAuto.FontUnderline].GetEnumValues()){
$sheet.getCellByPosition(0, $iy).String = $cline.ToString()
$cell = $sheet.getCellByPosition(1, $iy)
$cell.String = "リブレオフィス"
$cell.CharUnderlinne = $cline
$cell.CharUnderlineColor = $arcolor[$ic]
$iy++
$ic++
if ($ic -gt 2){ $ic = 0 }
}
$sheet.getCellRangeByName("A1:A19").getRows().Height = 600
$sheet.getCellRangeByName("A1").getColumns().OptimalWidth = $true
$sheet.getCellRangeByName("B1").getColumns().Width = 3000
$range = $sheet.getCellRangeByName("B1:B19")
$range.VertJustify = [CalcAuto.CellVertJustify]::CENTER
$range.HoriJustify = [CalcAuto.CellHoriJustify]::CENTER
pause
$libCalcd.calcClose()
$libOffice.terminate()
実行例