<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoPlainText"><span lang="EN-US">Hi Andrew,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Thanks a lot for your reply.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Q1: In your case do you only care about documents that have been saved... Ignoring new never saved to disk docs?<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US" style="font-family:Wingdings">à</span><span lang="EN-US">What I want to get is all calc documents as long as the doc is opened, no matter it have been saved or not.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> So firstly, I want to know if it</span><span lang="EN-US" style="font-family:"Courier New"">’</span><span lang="EN-US">s possible to do it in this case. If no, maybe I can only care the doc which have been saved
and ignore which is not saved.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Q2: You enumerate the open components from the desktop object and check of the component is a calc document.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US" style="font-family:Wingdings">à</span><span lang="EN-US">Sorry, I know how to get the desktop object, but I am not clear how to get the open component and check them as you mentioned.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> This is my gap, would you please give example code based on my comment for Q1?<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Thanks in advanced!<br>
<br>
<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Best Regards<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">William<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">-----Original Message-----<br>
From: Andrew Pitonyak [mailto:andrew@pitonyak.org] <br>
Sent: 2015</span><span style="font-family:宋体">年</span><span lang="EN-US">6</span><span style="font-family:宋体">月</span><span lang="EN-US">5</span><span style="font-family:宋体">日</span><span lang="EN-US"> 19:15<br>
To: Zhang, William<br>
Cc: libreoffice@lists.freedesktop.org<br>
Subject: Re: Q: How to get the path of all opened spreadsheet documents</span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">No time to find the solution now.... But I have done this sort of thing in basic.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">You enumerate the open components from the desktop object and check of the component is a calc document.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">In your case do you only care about documents that have been saved... Ignoring new never saved to disk docs?<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Think I can find a basic example of it helps<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">On Jun 4, 2015 10:35 PM, "Zhang, William" <<a href="mailto:william.zhang@ptn.advantest.com"><span style="color:windowtext;text-decoration:none">william.zhang@ptn.advantest.com</span></a>> wrote:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Hi,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Request:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> In RedHat7, I want to get the path of all opened spreadsheet documents with Java.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> What I</span><span lang="EN-US" style="font-family:"Courier New"">’</span><span lang="EN-US">ve done:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> 1.</span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"> I used Runtime.exec(cmd</span><span lang="EN-US" style="font-family:"Courier New"">…</span><span lang="EN-US">) with
Java code, the </span><span lang="EN-US" style="font-family:"Courier New"">‘</span><span lang="EN-US">cmd</span><span lang="EN-US" style="font-family:"Courier New"">’</span><span lang="EN-US"> was defined with
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">ps
</span><span lang="EN-US" style="font-family:"Courier New"">–</span><span lang="EN-US">ef | grep xxx</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> ->if only one spreadsheet document opened, the returned info list the correct document, I can parse it and get the file path<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> ->but if multi spreadsheet documents opened, the returned process still only list the first document, I cannot get other documents.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US">2.</span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"> I also test in bash, it seems
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">ps -ef</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> cannot list all files.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> So , I want to know is there any other way to do it. such as using UNO service with libreoffice API to get it.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Anyone who knows it is much appreciate.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Best Regards<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> William<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> </span><span lang="EN-US" style="font-family:"Courier New""> </span><span lang="EN-US"><o:p></o:p></span></p>
</div>
</body>
</html>