[appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-03 Thread Vik
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  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.



Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-03 Thread Ikai Lan (Google)
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  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  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.



Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-06 Thread Vik
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) 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  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  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.



Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-10 Thread Vik
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  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) 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  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  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.



Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-11 Thread Amit Pandey
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 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  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  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) 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  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  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 grou

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-11 Thread Amit Pandey
Mistakenly send wrong code. Here is correct code.

On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey  wrote:

> 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();
> // Now read the content from input stream.
> break;
>
> }
>
> Thanks,
> Amit
>
> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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) 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  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  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

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-12 Thread Vik
Hie Amit

Thanks however when i read the input stream using:
String content = CharStreams.toString(new InputStreamReader(inStream));

It prints all boxed characters rather plain english text. Please advise

Thankx and Regards

Vik
Founder
http://www.sakshum.org
http://blog.sakshum.org


On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey  wrote:

> Mistakenly send wrong code. Here is correct code.
>
> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey  wrote:
>
>> 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();
>> // Now read the content from input stream.
>> break;
>>
>> }
>>
>> Thanks,
>> Amit
>>
>> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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) 
 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  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  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 sub

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-13 Thread Amit Pandey
Have you used *org.apache.poi.hwpf.HWPFDocument* API ?

Thanks,
Amit

On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:

> Hie Amit
>
> Thanks however when i read the input stream using:
> String content = CharStreams.toString(new InputStreamReader(inStream));
>
> It prints all boxed characters rather plain english text. Please advise
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey  wrote:
>
>> Mistakenly send wrong code. Here is correct code.
>>
>> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey  wrote:
>>
>>> 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();
>>> // Now read the content from input stream.
>>> break;
>>>
>>> }
>>>
>>> Thanks,
>>> Amit
>>>
>>> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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) 
> 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  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  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.
>>> 

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-16 Thread Vik
No I did not used that.  Do i need that one?  I thought no. Please confirm.

And it is strange if google api gives me access to get handle to the doc
but need third party libraries to read it,


Thankx and Regards

Vik
Founder
http://www.sakshum.org
http://blog.sakshum.org


On Mon, Nov 14, 2011 at 1:10 PM, Amit Pandey  wrote:

> Have you used *org.apache.poi.hwpf.HWPFDocument* API ?
>
> Thanks,
> Amit
>
> On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:
>
>> Hie Amit
>>
>> Thanks however when i read the input stream using:
>> String content = CharStreams.toString(new InputStreamReader(inStream));
>>
>> It prints all boxed characters rather plain english text. Please advise
>>
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey  wrote:
>>
>>> Mistakenly send wrong code. Here is correct code.
>>>
>>> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey wrote:
>>>
 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();
 // Now read the content from input stream.
 break;

 }

 Thanks,
 Amit

 On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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) > > 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  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  wrote:

>

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-17 Thread Vik
hi

plz update on this?

Thankx and Regards

Vik
Founder
http://www.sakshum.org
http://blog.sakshum.org


On Wed, Nov 16, 2011 at 7:03 PM, Vik  wrote:

> No I did not used that.  Do i need that one?  I thought no. Please confirm.
>
> And it is strange if google api gives me access to get handle to the doc
> but need third party libraries to read it,
>
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Mon, Nov 14, 2011 at 1:10 PM, Amit Pandey  wrote:
>
>> Have you used *org.apache.poi.hwpf.HWPFDocument* API ?
>>
>> Thanks,
>> Amit
>>
>> On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:
>>
>>> Hie Amit
>>>
>>> Thanks however when i read the input stream using:
>>> String content = CharStreams.toString(new InputStreamReader(inStream));
>>>
>>> It prints all boxed characters rather plain english text. Please advise
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey wrote:
>>>
 Mistakenly send wrong code. Here is correct code.

 On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey wrote:

> 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();
> // Now read the content from input stream.
> break;
>
> }
>
> Thanks,
> Amit
>
> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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
>>

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-18 Thread Amit Pandey
I did it before and I used *HWPFDocument. *However it can be read directly
(without third party lib).

Try other ways to read the string from inputStream (other than CharStreams
 api). Also try setting different possible character encoding.

Let us know if this work.

Thanks,
Amit

On Fri, Nov 18, 2011 at 8:46 AM, Vik  wrote:

> hi
>
> plz update on this?
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Wed, Nov 16, 2011 at 7:03 PM, Vik  wrote:
>
>> No I did not used that.  Do i need that one?  I thought no. Please
>> confirm.
>>
>> And it is strange if google api gives me access to get handle to the doc
>> but need third party libraries to read it,
>>
>>
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Mon, Nov 14, 2011 at 1:10 PM, Amit Pandey  wrote:
>>
>>> Have you used *org.apache.poi.hwpf.HWPFDocument* API ?
>>>
>>> Thanks,
>>> Amit
>>>
>>> On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:
>>>
 Hie Amit

 Thanks however when i read the input stream using:
 String content = CharStreams.toString(new InputStreamReader(inStream));

 It prints all boxed characters rather plain english text. Please advise

 Thankx and Regards

 Vik
 Founder
 http://www.sakshum.org
 http://blog.sakshum.org


 On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey wrote:

> Mistakenly send wrong code. Here is correct code.
>
> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey wrote:
>
>> 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();
>> // Now read the content from input stream.
>> break;
>>
>> }
>>
>> Thanks,
>> Amit
>>
>> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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  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. Descr

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-11-30 Thread Vik
I did not try  *HWPFDocument*

but given code examples on the google site should work as it. Unfortunately
following code print some boxes and rough characters. Please suggest as its
blocking for us:

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 = null;
try {
inStream = ms.getInputStream();
int c;
while ((c = inStream.read()) != -1) {
  System.out.print((char)c);
}
  } finally {
if (inStream != null) {
  inStream.close();
}
  }
 }



Thankx and Regards

Vik
Founder
http://www.sakshum.org
http://blog.sakshum.org


On Fri, Nov 18, 2011 at 7:59 PM, Amit Pandey  wrote:

> I did it before and I used *HWPFDocument. *However it can be read
> directly (without third party lib).
>
> Try other ways to read the string from inputStream (other than CharStreams
>  api). Also try setting different possible character encoding.
>
> Let us know if this work.
>
> Thanks,
> Amit
>
> On Fri, Nov 18, 2011 at 8:46 AM, Vik  wrote:
>
>> hi
>>
>> plz update on this?
>>
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Wed, Nov 16, 2011 at 7:03 PM, Vik  wrote:
>>
>>> No I did not used that.  Do i need that one?  I thought no. Please
>>> confirm.
>>>
>>> And it is strange if google api gives me access to get handle to the doc
>>> but need third party libraries to read it,
>>>
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Mon, Nov 14, 2011 at 1:10 PM, Amit Pandey wrote:
>>>
 Have you used *org.apache.poi.hwpf.HWPFDocument* API ?

 Thanks,
 Amit

 On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:

> Hie Amit
>
> Thanks however when i read the input stream using:
> String content = CharStreams.toString(new InputStreamReader(inStream));
>
> It prints all boxed characters rather plain english text. Please advise
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey wrote:
>
>> Mistakenly send wrong code. Here is correct code.
>>
>> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey wrote:
>>
>>> 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();
>>> // Now read the content from input stream.
>>> break;
>>>
>>> }
>>>
>>> Thanks,
>>> Amit
>>>
>>> On Thu, Nov 10, 2011 at 4:09 PM, Vik  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.getPl

Re: [appengine-java] Re: Reading a Google Doc from google app engine code

2011-12-12 Thread Vik
Hie

Any advise on this please?

Thankx and Regards

Vik
Founder
http://www.sakshum.org
http://blog.sakshum.org


On Wed, Nov 30, 2011 at 10:49 PM, Vik  wrote:

> I did not try  *HWPFDocument*
>
> but given code examples on the google site should work as it.
> Unfortunately following code print some boxes and rough characters. Please
> suggest as its blocking for us:
>
> 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 = null;
> try {
> inStream = ms.getInputStream();
> int c;
> while ((c = inStream.read()) != -1) {
>   System.out.print((char)c);
> }
>   } finally {
> if (inStream != null) {
>   inStream.close();
> }
>   }
>  }
>
>
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Fri, Nov 18, 2011 at 7:59 PM, Amit Pandey  wrote:
>
>> I did it before and I used *HWPFDocument. *However it can be read
>> directly (without third party lib).
>>
>> Try other ways to read the string from inputStream (other than
>> CharStreams api). Also try setting different possible character encoding.
>>
>> Let us know if this work.
>>
>> Thanks,
>> Amit
>>
>> On Fri, Nov 18, 2011 at 8:46 AM, Vik  wrote:
>>
>>> hi
>>>
>>> plz update on this?
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Wed, Nov 16, 2011 at 7:03 PM, Vik  wrote:
>>>
 No I did not used that.  Do i need that one?  I thought no. Please
 confirm.

 And it is strange if google api gives me access to get handle to the
 doc but need third party libraries to read it,


 Thankx and Regards

 Vik
 Founder
 http://www.sakshum.org
 http://blog.sakshum.org


 On Mon, Nov 14, 2011 at 1:10 PM, Amit Pandey wrote:

> Have you used *org.apache.poi.hwpf.HWPFDocument* API ?
>
> Thanks,
> Amit
>
> On Sat, Nov 12, 2011 at 7:04 PM, Vik  wrote:
>
>> Hie Amit
>>
>> Thanks however when i read the input stream using:
>> String content = CharStreams.toString(new
>> InputStreamReader(inStream));
>>
>> It prints all boxed characters rather plain english text. Please
>> advise
>>
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Fri, Nov 11, 2011 at 5:46 PM, Amit Pandey wrote:
>>
>>> Mistakenly send wrong code. Here is correct code.
>>>
>>> On Fri, Nov 11, 2011 at 5:35 PM, Amit Pandey wrote:
>>>
 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();
 // Now read the content from input stream.
 break;

 }

 Thanks,
 Amit

 On Thu, Nov 10, 2011 at 4:09 PM, Vik  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.setM