Hi ViK,

I did the same before and I use *org.apache.poi.hwpf.HWPFDocument* API.
Following code snippet may be useful for you. Let me know if this works.

for (DocumentListEntry entry : resultFeed.getEntries()) {

String docId = entry.getDocId();
String docType = entry.getType();
URL exportUrl =
              new URL("https://docs.google.com/feeds/download/"; + docType
                  + "s/Export?docID=" + docId + "&exportFormat=doc");
MediaContent mc = new MediaContent();
mc.setUri(exportUrl.toString());
MediaSource ms = client.getMedia(mc);
InputStream inStream = ms.getInputStream();
StringBuffer sb = new StringBuffer();
 HWPFDocument hdDocument = new HWPFDocument(inStream);

 // getting the text pieces
 List<TextPiece> textPieces =
 hdDocument.getTextTable().getTextPieces();
 for (TextPiece temp : textPieces) {
         sb.append(temp.getStringBuffer());
 }
System.out.println(sb.toString());
break;

}

Thanks,
Amit

On Thu, Nov 10, 2011 at 4:09 PM, Vik <vik....@gmail.com> wrote:

> Hie
>
> Thanks I went through it and could at least get the handle to the google
> text doc i needed. I am now stuck at how to read the contents.
> My code looks like:
>
>
>  GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
> oauthParameters.setOAuthConsumerKey(Constants.CONSUMER_KEY);
>  oauthParameters.setOAuthConsumerSecret(Constants.CONSUMER_SECRET);
> oauthParameters.setOAuthToken(Constants.ACCESS_TOKEN);
>  oauthParameters.setOAuthTokenSecret(Constants.ACCESS_TOKEN_SECRET);
> DocsService client = new DocsService("sakshum-YourAppName-v1");
>  client.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
> URL feedUrl = new URL("https://docs.google.com/feeds/default/private/full/";);
>
>  DocumentQuery dquery = new DocumentQuery(feedUrl);
> dquery.setTitleQuery("blood_donor_verification_template_dev");
>  dquery.setTitleExact(true);
> dquery.setMaxResults(10);
> DocumentListFeed resultFeed = client.getFeed(dquery,
> DocumentListFeed.class);
>  System.out.println("feed size:" + resultFeed.getEntries().size());
> String emailBody = "";
>  for (DocumentListEntry entry : resultFeed.getEntries()) {
>  System.out.println(entry.getPlainTextContent());
>  emailBody = entry.getPlainTextContent();
> }
>
> Plz note that entry.getPlainTextContent() does not work and throws object
> not TextContent type exception
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Sun, Nov 6, 2011 at 10:24 PM, Vik <vik....@gmail.com> wrote:
>
>> Thanks for replying
>>
>> actually i just googled and could not really find matching to my needs.
>> thanks for the pointer this should be helpful.
>>
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Fri, Nov 4, 2011 at 12:01 AM, Ikai Lan (Google) <ika...@google.com>wrote:
>>
>>> Have you read this? What are your thoughts? What have you tried?
>>>
>>> http://code.google.com/apis/documents/
>>>
>>> Vik, your posts would be a lot more useful if you:
>>>
>>> 1. List what you have tried
>>> 2. Describe what didn't work
>>> 3. Describe what it is you are trying to do
>>>
>>> I like the fact that you keep emails short, but I suspect other people
>>> on this list have tuned you out because you're just not providing enough
>>> information when you ask for help and it's too much detective work for
>>> people who would actually help out otherwise.
>>>
>>> --
>>> Ikai Lan
>>> Developer Programs Engineer, Google App Engine
>>> plus.ikailan.com | twitter.com/ikai
>>>
>>>
>>>
>>> On Thu, Nov 3, 2011 at 10:42 AM, Vik <vik....@gmail.com> wrote:
>>>
>>>>  someone please help on this.
>>>>
>>>> Thankx and Regards
>>>>
>>>> Vik
>>>> Founder
>>>> http://www.sakshum.org
>>>> http://blog.sakshum.org
>>>>
>>>>
>>>> On Mon, Oct 31, 2011 at 7:11 PM, Vik <vik....@gmail.com> wrote:
>>>>
>>>>> Hie
>>>>>
>>>>> Can someone please guide on how to read a google doc from my gae code?
>>>>>
>>>>> Thankx and Regards
>>>>>
>>>>> Vik
>>>>> Founder
>>>>> http://www.sakshum.org
>>>>> http://blog.sakshum.org
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine for Java" group.
>>>> To post to this group, send email to
>>>> google-appengine-java@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-appengine-java+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-appengine-java?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google App Engine for Java" group.
>>> To post to this group, send email to
>>> google-appengine-java@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-appengine-java+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-appengine-java?hl=en.
>>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to