Jump to content

There's nothing here yet

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By VinMe
      Dear all, 
      I am working on automation of ms word, on which my scripts runs with multiple word document at a time. But I wanted all the word to be running in the background.
      do we have any UDF available? Please help.
    • By diff
      so I have started to learn to use the Word UDF and got issue to add my pictures after exact paragraphs. I was searching in the forum for the solution, checked with examples and still I don't understand how to add pictures after paragraph in new line.
      My word document has like 8 pages and for example on page I have paragraph named "My examples:" and here starts my problem.
      I have tried to do this:
      #include <Word.au3> Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($Word, @ScriptDir & "\examples.docx", Default, Default, True) $oSearchRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, 0) $oRangeFound = _Word_DocFind($oDoc, "My examples:", $oSearchRange) _Word_DocPictureAdd($oDoc, @ScriptDir & "\pic1.jpg", Default, Default, $oRangeFound) And here the picture adds before the paragraph My examples: on same line and looks like
      {pic1}My Examples:
      What I want to see is:
      My examples:
      {PICTURE IN NEW LINE} which is pic1.jpg from my code.
      How I can do that? I want to add 3 pictures in a row in new line each like:
      My examples:
      Hope I explained this well, but you can ask me if you need any additional information to clarify.
    • By ahha
      I'm trying to get the number of columns in a specific row in a Word table and am stuck.   I need a push.  Program below and Word file attached.
      #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window #include <Word.au3> $oWord = _Word_Create(True, True) ;Create Word application object, make it visible, and force a new instance of Word $oDoc = _Word_DocOpen($oWord, @ScriptDir&"\ColumnTest.docx", Default, Default, True) ;Open the Word document $iTablesCount = $oDoc.Tables.Count ;get Tables count in $oDoc Pause("$iTablesCount = '" & $iTablesCount & "'") $iRowCount = $oDoc.Tables.Item(1).Rows.Count ;Table hard coded $iColCount = $oDoc.Tables.Item(1).Columns.Count Pause("Table#1 $iRowCount = '" & $iRowCount & " $iColCount = '" & $iColCount & "'") ;trying to get the number of columns in each row ;$ColCountInRow = $oDoc.Tables.Item(1).Rows(1).Columns.Count ;this fails and read somewhere to use Cells.Count $ColCountInRow = $oDoc.Tables.Item(1).Rows(1).Cells.Count ;hard code Row 1 <<<<< ERROR here ;this is the error I get ;: ==> The requested action with this object has failed.: ;$ColCountInRow = $oDoc.Tables.Item(1).Rows(1).Cells.Count ;$ColCountInRow = $oDoc.Tables.Item(1)^ ERROR Pause("Row 1 has " & $ColCountInRow & " Columns") Exit Func Pause($text="") MsgBox(262144, "DEBUG", "Paused: " & $text) EndFunc  
    • By Fenzik
      i wrote this function as alternative to using the Com Object or Commandline version of this project, discussed also earlyer on this forum.
      Project site - http://ebstudio.info/home/xdoc2txt.html
      Advantage of this implementation is that you do not need to register Com dll, using regsvr32.
      But you still need the project Dll (xd2txlib.dll).
      ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ExtractText ; Description ...: Extracts text from advanced documment formats (Doc, Docx, ODT, XLS, ...) ; Syntax ........: _ExtractText($sFilename[, $bProperties = False[, $hDll = 0]]) ; Parameters ....: $sFilename - a string value. ; $bProperties - [optional] a boolean value. Default is False. If True, documment properties will be returned instead of the text. ; $hDll - [optional] a handle value. Default is 0. Optional handle to previously opened xd2txlib.dll. By default the xd2txlib.dll (Expected in @scriptdir) will be opened and closed during the function call. ; Return value .: String, containing the text or documment properties or empty string and Error as follows: ;1 - The file does not exists. ;2 - Error during opening xd2txlib.dll. ;3 - No text returned. ; Author ........: Fenzik ; Modified ......: ; Remarks .......: Project site - http://ebstudio.info/home/xdoc2txt.html ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ExtractText($sFilename, $bProperties = False, $hDll = 0) If Not FileExists($sFilename) Then Return SetError(1, "", "") Local $bLoaded = False If $hDll = 0 Then $hDll = DllOpen(@scriptdir&"\xd2txlib.dll") If $hDll = -1 Then Return SetError(2, "", "") $bLoaded = True Endif $aResult = DllCall($hDll, "int:cdecl", "ExtractText", "WSTR", $sFilename, "BOOL", $bProperties, "WSTR*", "") If $aResult[0] = 0 Then Return SetError(3, "", "") If $bLoaded = True Then DllClose($hDll) Return $aResult[3] EndFunc  
    • By lavascript
      I have a Word document containing a 9-column table where row 1 is the column headers. My goal is to read the table into a 2d array, remove some rows, update some fields, and add a few rows to the end. The resulting array will likely be a different length. Next, I want to write the data back into the table. If it's easier, I can write the data to a new document from a template containing the same table header with a blank 2nd row.
      Here's my early attempt:
      Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($oWord, $sFile) Local $aData = _Word_DocTableRead($oDoc, 1) $aData[3][5] = "Something else" Local $oRange = _Word_DocRangeSet($oDoc, 0) $oRange = _Word_DocRangeSet($oDoc, $oRange, $wdCell, 9) _Word_DocTableWrite($oRange,$aData) This, unfortunately, writes the entire array into the first cell of row 2. What am I doing wrong?
  • Create New...