æè¿ä½ã£ã¦ããèªåç¨ãã¼ã« ãããLibreOfficeã§éãã¦ãã表è¨ç®ããã¥ã¡ã³ãã®ã·ã¼ãåä¸è¦§ãåæãã¦ããããé¸æãããããã®ã·ã¼ããã¢ã¯ãã£ãã«ããããã§ãã¦ã¤ã³ãã¦ãåé¢ã«åºããã¿ãããªãã¨ãã§ããããã¨æã£ã¦èª¿ã¹ãã®ã§ä»¥ä¸ã«èªåç¨ã®ã¡ã¢
Excelã§ã¯åæ§ã®ãã¨ãå®ç¾ã§ãã¦ããããèªå® ã§ã¯LibreOfficeã使ã£ã¦ããã®ã§åããã¨ã§ããªããã¨æã£ã¦èª¿ã¹ããã§ãããã§ãããã¨ãããã£ãã
ã¨ãããããJScriptã§æ¸ãã¦ãããããã¨ã§C++ã®COMã§ä½¿ãå½¢ã«æ¸ãæãã
var factory = new ActiveXObject("com.sun.star.ServiceManager"); var loader = factory.createInstance("com.sun.star.frame.Desktop"); var docs = loader.getComponents(); var e = docs.createEnumeration(); while(e.hasMoreElements()) { var doc = e.nextElement(); // ããã¥ã¡ã³ãã®ãã¹(URL)ãåå¾ WScript.Echo(doc.getURL()); // ã·ã¼ããªãã¸ã§ã¯ããåå¾ var sheets = doc.getSheets(); // ã·ã¼ãæ°ãå¾ã var sheetCount = sheets.getCount(); WScript.Echo(sheetCount); // ã·ã¼ãåãåæãã for (var i = 0; i < sheetCount; ++i) { var sheet = sheets.getByIndex(i); WScript.Echo(sheet.name); } // ã¢ã¯ãã£ããªã¯ã¼ã¯ã·ã¼ããå¤ãã var controller = doc.getCurrentController(); if (sheetCount >= 4) { // ä¾ãã°ã4çªç®ã®ã¯ã¼ã¯ã·ã¼ããã¢ã¯ãã£ãã«ãã controller.setActiveSheet(sheets.getByIndex(3)); } var frame = controller.getFrame(); // ã¦ã¤ã³ãã¦ãåé¢ã«åºã // â» ãã ããä»æ¥ã®ç°å¢ã ã¨ãã¿ã¹ã¯ãã¼ä¸ã®Calcã®ã¢ã¤ã³ã³ãç¹æ» ããã ãã«ãªã£ã¦ãã¾ãã frame.getContainerWindow().toFront(); }
- å¤åããã§åæãããããã¥ã¡ã³ãã¯è¡¨è¨ç®ä»¥å¤ã®ããã¥ã¡ã³ããå«ã¾ããå½¢ã«ãªãã¯ã
- 種é¡ãå¤å¥ããæ¹æ³ã¯ããã¯ãã ãã©èª¿ã¹ã¦ããªããã¨ããããããã¥ã¡ã³ããã¹ã®æ¡å¼µåã§ãå¤æã§ããããªæ°ã
- ã¦ã¤ã³ãã¦ãåé¢ã«åºãã®ã¯
toFront()
ã使ãã®ã§ã¯ãªããã¦ã¤ã³ãã¦ãã³ãã«ãæ¢ãã¦ãAttachThreadInput()
âSetForegroundWindow()
ã§ãããã¯ã- 確å®ãããªããããããªããã©ãããã¥ã¡ã³ããã¹ã¨ã¦ã¤ã³ãã¦ã¿ã¤ãã«ãè¦ãã°è¦ã¤ããããããªæ°ããã¦ãã