by davehook at 2012-10-01 08:50:36
I create a table in word with cells 1 to 5 coming from a csv, this works fine. In cell 6 I want to place a small png icon (the same one for all records) Any idea how I code this?by surveyor at 2012-10-02 03:57:19
$UserTable =$Word.ActiveDocument.Tables.Add($Word.Selection.Range, 1, 6)
$UserTable.Cell(1,1).Range.Text = "Post No"
$UserTable.Cell(1,2).Range.Text = "Force/Contract"
$UserTable.Cell(1,3).Range.Text = "Last Audit Date"
$UserTable.Cell(1,4).Range.Text = "Comment"
$UserTable.Cell(1,5).Range.Text = "Type of Contract"
$UserTable.Cell(1,6).Range.Text = "status"
$TableRowPosition = 2
foreach ($ObjItem in $wordtext) {
$UserTable.Rows.Add()
$UserTable.Cell($TableRowPosition,1).Range.Text = $ObjItem.postno
$UserTable.Cell($TableRowPosition,2).Range.Text = $ObjItem.force
$UserTable.Cell($TableRowPosition,3).Range.Text = $ObjItem.lastaudited
$UserTable.Cell($TableRowPosition,4).Range.Text = $ObjItem.comment
$UserTable.Cell($TableRowPosition,5).Range.Text = $ObjItem.HWR
$UserTable.Cell($TableRowPosition,6).???image???
Many thanks
A quick recording in Word shows this in VBA, maybe it helps?by davehook at 2012-10-03 04:37:20Selection.InlineShapes.AddPicture FileName:="D:\Bilder\Logos\AAA.bmp", LinkToFile:=False, SaveWithDocument:=True
Any body tell me what the last line of the above script (for cell 6) would read as im obviously doing this wrong? The image copies multiple times into cel 1, 1by davehook at 2012-10-03 05:16:39
Thanks
Worked it out
$UserTable.Cell($TableRowPosition,4).Range.InlineShapes.AddPicture("C:\DiscoveryData\images\greencircle.png")
thanks all