Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Win32::OLE and Word

    I'm using Perl to automate the creation/manipulation of Word documents.
    I'm doing fine other than adding tabs. I recorded the following macro
    information for reference:

    Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(1),
    _
    Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(4),
    _
    Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(5),
    _
    Alignment:=wdAlignTabCenter, Leader:=wdTabLeaderSpaces

    I'm trying to get that translated to Perl. Any help you can provide
    would be greatly appreciated.

    I did find the following code online, but it doesn't seem to work:

    $doc = $word->Documents->Add;
    $selection = $word->Selection;
    $selection->ParagraphFormat->{TabStops}->Add($word->InchesToPoints(4));

    Alfredo Guest

  2. Similar Questions and Discussions

    1. Dave Roth's site (Win32::AdminMisc, Win32::ODBC, etc.) not available.
      Does anyone know of an alternate method to contact Dave Roth (other then rothd@roth.net )? It appears that his entire domain is unavailable...
    2. Getting Word Count from MS Word files
      I would like to get the word count of MS Word files. I found a CFX tag on the exchange: CFX_FileSummary, but the download page is a dead link, as...
    3. Win32-PerfMon on Win32
      Windows 2000(SP4) ActivePerl 5.8.3 I found this escapade rather confusing, I'm warning you now. I cannot install this Win32-PerfMon module, I...
    4. Preventing MS Word Footers being used in word to pdf conversion
      Is it possible to stop Adobe PDF 6.0 pro from importing the page headers and/or footers on a batch of Word documents when converting the docuements...
    5. Editing Word documents in Perl (Openoffice Writer or MS Word)
      Hello, I want to read and edit openoffice / staroffice writer documents. Does anyone know of any modules for that? Ideally, I would've liked a...
  3. #2

    Default Re: Win32::OLE and Word

    Alfredo,

    You found something close enough that I ended up guessing the rest of the solution. Try this:

    $selection = $word->Selection;
    $selection->ParagraphFormat->{Alignment} = wdAlignTabLeft;
    $selection->ParagraphFormat->{Alignment} = wdAlignTabCenter;
    $selection->ParagraphFormat->{Alignment} = wdAlignTabRight;

    This worked for me. I hope it works as well for you.

    - Greg
    Greg M Brown is offline Junior Member
    Join Date
    Nov 2010
    Posts
    1

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139