Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Here is the code which I am using
my ($File, $Doc_dir); $Doc_dir = "C:\\word_files"; opendir(TEMP,$Doc_dir); while ($File = readdir(TEMP)) { unless ($File eq "." or $File eq "..") { my $f_check = substr($File,0,2); unless ($f_check eq '~$') { my $Full_File = "$Doc_dir\\$File"; my $f_name = substr($File,0,((length($File))-4)); my $Word = Win32::OLE->new( 'Word.Application', 'Quit' ) | +| die "Couldn't run Word"; my $Doc = $Word->Documents->Open($Full_File) || die "File +does not exist or can not be opened"; # Text information my $num_pages = $Doc->ComputeStatistics(wdStatisticPa +ges); my $num_paragraphs = $Doc->ComputeStatistics(wdStatisticPa +ragraphs); my $num_lines = $Doc->ComputeStatistics(wdStatisticLi +nes); my $num_words = $Doc->ComputeStatistics(wdStatisticWo +rds); my $num_chars = $Doc->ComputeStatistics(wdStatisticCh +aracters); my $num_charWs = $Doc->ComputeStatistics(wdStatisticCh +aractersWithSpaces); my $header = $Doc->Sections(1)->Headers(wdHeaderFooterPrim +ary); my $h_num_pages = $header->Range->ComputeStatistics(w +dStatisticPages); my $h_num_paragraphs = $header->Range->ComputeStatistics(w +dStatisticParagraphs); my $h_num_lines = $header->Range->ComputeStatistics(w +dStatisticLines); my $h_num_words = $header->Range->ComputeStatistics(w +dStatisticWords); my $h_num_chars = $header->Range->ComputeStatistics(w +dStatisticCharacters); my $h_num_charWs = $header->Range->ComputeStatistics(w +dStatisticCharactersWithSpaces); my $footer = $Doc->Sections(1)->Footers(wdHeaderFooterPrim +ary); my $f_num_pages = $footer->Range->ComputeStatistics(w +dStatisticPages); my $f_num_paragraphs = $footer->Range->ComputeStatistics(w +dStatisticParagraphs); my $f_num_lines = $footer->Range->ComputeStatistics(w +dStatisticLines); my $f_num_words = $footer->Range->ComputeStatistics(w +dStatisticWords); my $f_num_chars = $footer->Range->ComputeStatistics(w +dStatisticCharacters); my $f_num_charWs = $footer->Range->ComputeStatistics(w +dStatisticCharactersWithSpaces); #$Word->Activedocument->Close (0); #$Doc->{Saved} = 0; #$Doc->Close(0); my $sys_com = "del $Full_File"; system ($sys_com); } } } close(TEMP); $dbh->disconnect;

In reply to Asking for saving the document, I don't want that it ask for this?? by nicholas

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2023-12-07 23:09 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (33 votes). Check out past polls.