Improve drawing export and foundation quantity views
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
a0ec74b09b
commit
d22c5008f0
72 files changed
+24346
-12
No files matched your search
@@ -0,0 +1,34 @@
|
||||
$ErrorActionPreference='Stop'
|
||||
function Retry([scriptblock]$Action){for($i=0;$i -lt 40;$i++){try{return & $Action}catch{Start-Sleep -Milliseconds 250}};throw 'Excel busy'}
|
||||
$root=Split-Path $PSScriptRoot -Parent
|
||||
$excel=$null;$book=$null
|
||||
try {
|
||||
$excel=New-Object -ComObject Excel.Application
|
||||
Retry {$excel.Visible=$true}
|
||||
Retry {$excel.DisplayAlerts=$false}
|
||||
Retry {$excel.AskToUpdateLinks=$false}
|
||||
Retry {$excel.AutomationSecurity=3}
|
||||
$book=Retry {$excel.Workbooks.Open((Join-Path $root '교각수량산출.xlsx'),0,$true)}
|
||||
$excel.ActiveWindow.DisplayHeadings=$false
|
||||
$excel.ActiveWindow.DisplayGridlines=$false
|
||||
$items=@(
|
||||
@('3.1 수량산출기준_토공','A2:AA95','criteria-earth'),
|
||||
@('3.1 수량산출기준_구조체 현황','A2:AC51','criteria-status'),
|
||||
@('3.1 수량산출기준_구조체','A2:AC102','criteria-structure'),
|
||||
@('3.2 관련변수','A2:AA16','variables-diagram')
|
||||
)
|
||||
foreach($item in $items){
|
||||
$sheet=$book.Worksheets.Item($item[0])
|
||||
$sheet.PageSetup.PrintArea=$item[1]
|
||||
$sheet.PageSetup.PrintHeadings=$false
|
||||
$sheet.PageSetup.PrintGridlines=$false
|
||||
$sheet.PageSetup.Zoom=$false
|
||||
$sheet.PageSetup.FitToPagesWide=1
|
||||
$sheet.PageSetup.FitToPagesTall=1
|
||||
$sheet.ExportAsFixedFormat(0,(Join-Path $root ('.cache/'+$item[2]+'.pdf')))
|
||||
Write-Output $item[2]
|
||||
}
|
||||
} finally {
|
||||
if($book){Retry {$book.Close($false)};[void][Runtime.InteropServices.Marshal]::ReleaseComObject($book)}
|
||||
if($excel){Retry {$excel.Quit()};[void][Runtime.InteropServices.Marshal]::ReleaseComObject($excel)}
|
||||
}
|
||||
Reference in new issue
Block a user