Hi,
How do I parse all the selected data either it is text or drop down item or check box from a word template document using PowerShell. I have tried using the below code but it just prints the data as it is irrespective of selected data, I mean it prints all the data. Any help would be greatly appreciated. I am looking for a solution either in parsing logic or exporting just the selected data to another file(XML or Excel) from a word template.
$Log = "C:\Users\Desktop\Test.txt"
$filename = "C:\Users\Desktop\WordDocTest.docx"
$objWord = New-Object -Com Word.Application
$objWord.Visible = $false
$objDocument = $objWord.Documents.Open($filename)
$paras = $objDocument.Paragraphs
foreach ($para in $paras)
{
Write-Output $para.Range.Text
}
$objWord.ActiveDocument.Close()
$objWord.Quit()
thanks in advance.
[EDIT - CHill60 .. post OP info from solution]
ok, let me clarify, I have a Word Template document which has multiple tables, and each table has its own data like text, dropdown data, check boxes, radio buttons..etc, Above code prints all the data irrespective of data selected against the text controls. My expectation is to print only selected data for suppose see the below example:
Personal Details: (This is table1 in Template)
Name: XYZ
Gender : Male (- this is drop down)
Residenace : (.)US ()Non-US
Lang Speak: [x]English []Spanish [x]French []German
Personal Details: (This is table2 in Template)
Study: MS (dropdown)
Are you single? : Yes
Please let me know if you need more info.