Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:28:04+00:00 2026-06-18T16:28:04+00:00

I am generating reports resulting in WORD files using xdocreport. From the generated report,

  • 0

I am generating reports resulting in WORD files using xdocreport.

From the generated report, I create a InputStreamContent with MIME-TYPE "application/vnd.openxmlformats-officedocument.wordprocessingml.document" (MS WORD – DOCX) to write to Google Drive :

// create Word file stream using xdocreport
OutputStream2InputStream outputStream = new OutputStream2InputStream(); // buffer
report.process(context, outputStream);
// create inputstream for Google Drive
InputStreamContent inputStream = new InputStreamContent("application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        outputStream.getInputStream());
inputStream.setLength(outputStream.size());

WRITING MSWORD DOCUMENT WORKS FINE (CONVERT= FALSE) :

File file = new File();
Insert insertOperation = service.files().insert(file, inputStream).setConvert(false);
file.setTitle("test.docx");
file.setMimeType(inputstream.getType());
File result = insertOperation.execute();

Resulting in a WORD DOCX file created on my Google Drive.

WRITING SAME INPUTSTREAM WITH CONVERT=TRUE FAILS

File file = new File();
Insert insertOperation = service.files().insert(file, inputStream).setConvert(true);
file.setTitle("test");
//file.setMimeType(inputstream.getType()); // what here ? 
File result = insertOperation.execute();

RESULT

1. When NOT setting the mime type : newly created File result has 0 bytes and MIME-type: application/vnd.google-apps.kix

2. When setting the mime type : MIME-TYPE set to “application/vnd.google-apps.document” and convert = true, results in 400: BAD REQUEST.

What am I doing wrong ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:28:05+00:00Added an answer on June 18, 2026 at 4:28 pm

    This is a common problem. Don’t set a MIME type in the request metadata. Google Drive will decide the MIME type to convert to.

    Your line marked // what here ? should be left out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The situation: I am generating reports using Report Builder 2.0 and a Report Model
I received reports that a my report generating application was not working. After my
Using Crystal Report 8.5 Generating a report from table1 My Crystal Report Output ID
I am generating PDF/HTML report from a BIRT template. I am using visibility property
I'm generating a reporting services report from an ASP.NET (MVC) based application but am
I am generating reports with Oracle BI Publisher 11.1.1.6. All generated report's file names
We're currently generating reports for our web application using html5 / css3, and they
We are generating reports based on iReports and JasperReports for web application. Using iReports
I have an application and I am generating Jasper Reports from it. But when
I am generating an ssrs report in my Silverlight application and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.