hoangduit / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Unable to upload .xlsx file #235

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new workbook in Excel 2007
2. Save it as .xlsx file (ordinary 2007 format)
3. Try to upload this file - service.UploadDocument("", null);
4. Gets an exception  - threw exception:  System.ArgumentException: File 
extension 'XLSX' is not recognized as valid..

It works properly if I save the same in the format 1997-2003, .xls 
extension

What is the expected output? What do you see instead?
The file has to be uploaded to gdocs.

What version of the product are you using? On what operating system?
Windows XP SP3. Office 2007 Professional

Please provide any additional information below.

Original issue reported on code.google.com by DenisSol...@gmail.com on 12 Apr 2009 at 11:49

GoogleCodeExporter commented 9 years ago
can you upload this file through the UI? 

Frank

Original comment by fman...@gmail.com on 14 Apr 2009 at 1:14

GoogleCodeExporter commented 9 years ago
Yes. I can.
I investigated the source files of API (documentservice.cs) and found that 
formats: 
".docx", "xlsx" is not supported. There are only: ".doc", ".xls"
The part of source below. Is it going to be supported the 2007 file format? Is 
there 
any workarounds to upload files with extensions: ".docx", "xlsx"
 static DocumentsService()
        {
            GDocumentsAllowedTypes = new Hashtable();
            GDocumentsAllowedTypes.Add("CSV", "text/csv");
            GDocumentsAllowedTypes.Add("TAB", "text/tab-separated-values");
            GDocumentsAllowedTypes.Add("TSV", "text/tab-separated-values");
            GDocumentsAllowedTypes.Add("TXT", "text/plain");
            GDocumentsAllowedTypes.Add("HTML", "text/html");
            GDocumentsAllowedTypes.Add("HTM", "text/html");
            GDocumentsAllowedTypes.Add("DOC", "application/msword");
            GDocumentsAllowedTypes.Add("ODS", "application/x-
vnd.oasis.opendocument.spreadsheet");
            GDocumentsAllowedTypes.Add("ODT", 
"application/vnd.oasis.opendocument.text");
            GDocumentsAllowedTypes.Add("RTF", "application/rtf");
            GDocumentsAllowedTypes.Add("SXW", "application/vnd.sun.xml.writer");
            GDocumentsAllowedTypes.Add("XLS", "application/vnd.ms-excel");
            GDocumentsAllowedTypes.Add("PPT", "application/vnd.ms-powerpoint");
            GDocumentsAllowedTypes.Add("PPS", "application/vnd.ms-powerpoint");
            GDocumentsAllowedTypes.Add("PDF", "application/pdf");
        }

Original comment by DenisSol...@gmail.com on 14 Apr 2009 at 1:18

GoogleCodeExporter commented 9 years ago
Yeah, i got that list from somewhere, do not recall from where though. I am 
going to add those 2 extensions to 
the list, if you need this now, just add them and recompile, or sync to the 
depot shortly. I only changed the 
source code, so you would have to build the DLL yourself.

Original comment by fman...@gmail.com on 14 Apr 2009 at 1:32

GoogleCodeExporter commented 9 years ago
Thanks. I'll try and update you with result.

Original comment by DenisSol...@gmail.com on 14 Apr 2009 at 1:34

GoogleCodeExporter commented 9 years ago
I added to required extension to map. There is no anymore error "wrong format". 
However I got other error "Unable to convert document". It looks that still 
wrong 
request is being built.
The same document I'm able upload via UI.

Original comment by DenisSol...@gmail.com on 14 Apr 2009 at 6:34