Jump to content

Recommended Posts

Posted

Hi,

I  need a good idea or a small example on how to target the find replace for a single cell 
for instance if there is a "zero" that needs to be found and replaced then its a problem when other cells contain zeros 

Didn't really yet get to find out more of the possibility's available ..  looking

TIA
 

Posted

Thanks I'm reading the table from array and replacing like so :

Func _replace($table, $row, $col, $find = "", $replace = '')
        $oDoc.Tables($table).Cell($row, $col + 1).Range.Text = $replace
EndFunc   ;==>_replace

but now, how do i keep the alignment formatting of the cell after the replace takes place ..

Posted

Example:
https://msdn.microsoft.com/en-us/library/office/ff835817.aspx

#include <Word.au3>
Local $sWord = @ScriptDir & "\Word.docx"
Local $oWord = _Word_Create()
Local $oDoc = _Word_DocOpen($oWord, $sWord)
Local $oTables = $oDoc.Tables
If StringReplace($oDoc.Tables(1).Cell(2,2).Range.Text, Chr(7), "") = 0 Then
    $oDoc.Tables(1).Cell(2,2).Range.Text = 1
    $oDoc.Tables(1).Cell(2,2).Range.ParagraphFormat.Alignment = 1
EndIf

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...