File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Gets tables in a document
4+ . DESCRIPTION
5+ Gets any table elements within a Word document.
6+ #>
7+ $doc = $this
8+ if ($doc -isnot [xml ]) { return }
9+ foreach ($wordTable in
10+ $doc |
11+ Select-Xml - XPath ' //w:tbl' - Namespace @ {w = ' http://schemas.openxmlformats.org/wordprocessingml/2006/main' }
12+ ) {
13+ $table = $wordTable.Node
14+ if ($table.pstypenames [0 ] -ne ' OpenXML.Word.Table' ) {
15+ $table.pstypenames.insert (0 , ' OpenXML.Word.Table' )
16+ }
17+ if (-not $table.FilePath ) {
18+ $table.psobject.properties.add (
19+ [psnoteproperty ]::new(" FilePath" , $this.FilePath ), $false
20+ )
21+ }
22+ if (-not $table.OpenXML ) {
23+ $table.psobject.properties.add (
24+ [psnoteproperty ]::new(" OpenXML" , $this.OpenXML ), $false
25+ )
26+ }
27+ $table
28+ }
29+
30+
31+
32+
33+
Original file line number Diff line number Diff line change 1+ return $this.Document.Table
You can’t perform that action at this time.
0 commit comments