mirror of
https://github.com/Micke-K/IntuneManagement.git
synced 2026-09-28 10:55:38 +02:00
3.10.1.6
Issues 375 - Add support for Strict Open XML document
This commit is contained in:
@@ -63,8 +63,17 @@ function Add-WordOptionsControl
|
|||||||
$global:spWordCustomProperties.Visibility = (?: ($global:cbWordDocumentationProperties.SelectedValue -ne "custom") "Collapsed" "Visible")
|
$global:spWordCustomProperties.Visibility = (?: ($global:cbWordDocumentationProperties.SelectedValue -ne "custom") "Collapsed" "Visible")
|
||||||
$global:txtWordCustomProperties.Visibility = (?: ($global:cbWordDocumentationProperties.SelectedValue -ne "custom") "Collapsed" "Visible")
|
$global:txtWordCustomProperties.Visibility = (?: ($global:cbWordDocumentationProperties.SelectedValue -ne "custom") "Collapsed" "Visible")
|
||||||
|
|
||||||
$global:cbWordDocumentationFormat.ItemsSource = ("[ { Name: `"Docx`",Value: `"docx`" }, { Name: `"PDF`",Value: `"pdf`" }]" | ConvertFrom-Json)
|
$global:cbWordDocumentationFormat.ItemsSource = ("[ { Name: `"Word default document (docx)`",Value: `"wdFormatDocumentDefault`" }, { Name: `"Strict Open XML document`",Value: `"wdFormatStrictOpenXMLDocument`" }, { Name: `"PDF`",Value: `"wdFormatPDF`" }]" | ConvertFrom-Json)
|
||||||
$global:cbWordDocumentationFormat.SelectedValue = (Get-Setting "Documentation" "WordDocumentFormat" "docx")
|
$currentFormat = (Get-Setting "Documentation" "WordDocumentFormat" "wdFormatDocumentDefault")
|
||||||
|
if($currentFormat -eq "pdf")
|
||||||
|
{
|
||||||
|
$currentFormat = "wdFormatPDF"
|
||||||
|
}
|
||||||
|
elseif($currentFormat -eq "docx")
|
||||||
|
{
|
||||||
|
$currentFormat = "wdFormatDocumentDefault"
|
||||||
|
}
|
||||||
|
$global:cbWordDocumentationFormat.SelectedValue = $currentFormat
|
||||||
|
|
||||||
$global:cbWordDocumentationLevel.ItemsSource = ("[ { Name: `"Full`",Value: `"full`" }, { Name: `"Limited`",Value: `"limited`" }, { Name: `"Basic`",Value: `"basic`" }]" | ConvertFrom-Json)
|
$global:cbWordDocumentationLevel.ItemsSource = ("[ { Name: `"Full`",Value: `"full`" }, { Name: `"Limited`",Value: `"limited`" }, { Name: `"Basic`",Value: `"basic`" }]" | ConvertFrom-Json)
|
||||||
$global:cbWordDocumentationLevel.SelectedValue = (Get-Setting "Documentation" "WordDocumentationLevel" "full")
|
$global:cbWordDocumentationLevel.SelectedValue = (Get-Setting "Documentation" "WordDocumentationLevel" "full")
|
||||||
@@ -405,6 +414,17 @@ function Invoke-WordPostProcessItems
|
|||||||
$script:doc.TablesOfFigures | ForEach-Object -Process { $_.Update() | Out-Null }
|
$script:doc.TablesOfFigures | ForEach-Object -Process { $_.Update() | Out-Null }
|
||||||
$script:doc.TablesOfAuthorities | ForEach-Object -Process { $_.Update() | Out-Null }
|
$script:doc.TablesOfAuthorities | ForEach-Object -Process { $_.Update() | Out-Null }
|
||||||
|
|
||||||
|
Write-Log "Using document format: $($global:cbWordDocumentationFormat.SelectedValue)"
|
||||||
|
try {
|
||||||
|
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]$global:cbWordDocumentationFormat.SelectedValue
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-LogError "Document validation failed" $_.Exception
|
||||||
|
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatDocumentDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
if($global:cbWordDocumentationFormat.SelectedValue -eq "pdf")
|
if($global:cbWordDocumentationFormat.SelectedValue -eq "pdf")
|
||||||
{
|
{
|
||||||
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatPDF
|
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatPDF
|
||||||
@@ -412,6 +432,7 @@ function Invoke-WordPostProcessItems
|
|||||||
else {
|
else {
|
||||||
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatDocumentDefault
|
$format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatDocumentDefault
|
||||||
}
|
}
|
||||||
|
#>
|
||||||
|
|
||||||
$fileName = $global:txtWordDocumentName.Text
|
$fileName = $global:txtWordDocumentName.Text
|
||||||
if(-not $fileName)
|
if(-not $fileName)
|
||||||
@@ -436,6 +457,7 @@ function Invoke-WordPostProcessItems
|
|||||||
Write-LogError "Failed to save file $fileName" $_.Excption
|
Write-LogError "Failed to save file $fileName" $_.Excption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if($global:chkWordOpenDocument.IsChecked -eq $true -and $global:hideUI -ne $true)
|
if($global:chkWordOpenDocument.IsChecked -eq $true -and $global:hideUI -ne $true)
|
||||||
{
|
{
|
||||||
$script:wordApp.Visible = $true
|
$script:wordApp.Visible = $true
|
||||||
@@ -449,6 +471,16 @@ function Invoke-WordPostProcessItems
|
|||||||
$script:wordApp.Quit()
|
$script:wordApp.Quit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Write-LogError "Failed to close the Word application" $_.Exception
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($script:doc)
|
||||||
|
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($script:wordApp)
|
||||||
|
[GC]::Collect(); [GC]::WaitForPendingFinalizers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Set-WordContentControlText
|
function Set-WordContentControlText
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user