ãããã§ï¼Wordææ¸ã®å 容ãèªã¿åãããï¼WSH/JScriptã§Wordãã¡ã¤ã«ãæä½ããæ¹æ³ï¼
WSHããWordææ¸ï¼.docãã¡ã¤ã«ï¼ã®å
容ãèªã¿åãã
- 段è½ãã¨ã®èªã¿åã
- è¦åºããã¨ã®èªã¿åãï¼ç¹å®ã®ã¹ã¿ã¤ã«ã®æ®µè½ã®ã¿ãæ½åºï¼
- âè¦åºãã ããæ½åºããã°ï¼Wordææ¸ã®ãã¢ã¦ãã©ã¤ã³ããããã¹ãå½¢å¼ã§çæã§ããã
段è½ãã¨ã®èªã¿åã
æå®ããWordææ¸å ã®å ¨æååãï¼æ®µè½ãã¨ã«åºåãããããã
var doc_file_path = "D:\\temp\\a.doc"; function log(s){ WScript.Echo( s ); } // Wordãèµ·åãã var word = WScript.CreateObject("Word.Application"); word.Visible = true; // æå®ããWordãã¡ã¤ã«ãéã var doc = word.Documents.Open( doc_file_path ); // å ¨ã¦ã®æ®µè½ã«ã¤ãã¦ã«ã¼ã var num_paras = doc.Paragraphs.Count; for( var i = 1; i <= num_paras; i ++ ) { // ãã®æ®µè½å ã®æååãåå¾ var txt_in_para = doc.Paragraphs( i ).Range.Text; // ãã®æ®µè½ã«é¢ããæ å ±ã表示 log( "[para " + i + "] " + txt_in_para ); } // ãã¡ã¤ã«ãéãã doc.Close(); // ã¯ã¼ããçµäºãã word.Quit();
Wordã®ãã¯ãã§æ®µè½ãæä½ãã
http://stabucky.com/wp/archives/1037
è¦åºããã¨ã®èªã¿åãï¼ç¹å®ã®ã¹ã¿ã¤ã«ã®æ®µè½ã®ã¿ãæ½åºï¼
æå®ããWordææ¸å
ã®å
¨ãè¦åºããï¼ç« ãªã©ï¼ãåºåãããããã
ç°¡æã¢ã¦ãã©ã¤ã³æ½åºã
var doc_file_path = "D:\\temp\\a.doc"; function log(s){ WScript.Echo( s ); } // Wordãèµ·åãã var word = WScript.CreateObject("Word.Application"); word.Visible = true; // æå®ããWordãã¡ã¤ã«ãéã var doc = word.Documents.Open( doc_file_path ); // å ¨ã¦ã®æ®µè½ã«ã¤ãã¦ã«ã¼ã var num_paras = doc.Paragraphs.Count; for( var i = 1; i <= num_paras; i ++ ) { // ãã®æ®µè½ var para = doc.Paragraphs( i ); // ãã®æ®µè½ã®ã¹ã¿ã¤ã«å var style_name = "" + para.Style; // ã¹ã¿ã¤ã«åã«ãè¦åºããã¨ããèªãå«ã¾ãã¦ããã if( style_name.match("è¦åºã") ) { // ãã®æ®µè½ã®rangeãªãã¸ã§ã¯ã var range = para.range; // ãã®è¦åºãã®æ®µè½çªå·ãåå¾ï¼ãï¼ç« ããªã©ã®æååï¼ var list_string = range.ListFormat.ListString; // ãã®è¦åºãã®æååãåå¾ï¼ç« çªå·ãªã©ãé¤ããé¨åï¼ var txt_in_para = range.Text txt_in_para = txt_in_para.replace( /\r\n/g, "" ); // æ¹è¡ãé¤å»ãã¦ãã // ãã®è¦åºãã®åå¨ãããã¼ã¸çªå·ãåå¾ var wdActiveEndPageNumber = 3; range.Select(); var page_num = word.Selection.Information( wdActiveEndPageNumber ); // ã[3ãã¼ã¸][ï¼ç« ] ã¯ããã«ãã®ããã«è¡¨ç¤º log( "[" + page_num + "ãã¼ã¸][" + list_string + "] " + txt_in_para ); } } // ãã¡ã¤ã«ãéãã doc.Close(); // ã¯ã¼ããçµäºãã word.Quit();
ã¯ã¼ãã®ãã¯ãã§æ®µè½çªå·ï¼æåãå«ãï¼åå¾ã£ã¦ã§ãã¾ãã
http://okwave.jp/qa/q3085439.html
- Selection.Paragraphs(1).Range.ListFormat.ListString
æç« ã®è¦åºãã®é çªã¨è¦åºãåã表示ãããã
http://www.moug.net/faq/viewtopic.php...
- para.Range.ListFormat.ListString
ãã¼ã¸çªå·ã調ã¹ã
http://questionbox.jp.msn.com/qa23712...
- Selection.Information(wdActiveEndPageNumber)
Word ãªã¼ãã¡ã¼ã·ã§ã³ã使ç¨ãã¦ææ¸ã®åã»ã¯ã·ã§ã³ã®ãã¼ã¸æ°ãã«ã¦ã³ãããæ¹æ³
http://support.microsoft.com/kb/29386...
- oSec.Range.Information(3) - 1 'wdActiveEndPageNumber=3
è£è¶³
WSHããWordãèªåæä½ããéã«ã¯ï¼Word VBAã®æ å ±ã大ãã«å½¹ç«ã¤ã
Word VBA ã®å ¥éç¨ãªã³ã¯éãï¼ã¯ã¼ããã¯ãã®ï¼ãµã³ãã«ã³ã¼ãããªãã¡ã¬ã³ã¹ï¼
http://language-and-engineering.hatenablog.jp/entry/20100314/p1
ã