public Stream Download(ITaskItem document, string exportFormat) { Document.DocumentType documentType = document.RequireDocumentType(); string baseUrl = document.RequireExportUri(); if (!string.IsNullOrEmpty(exportFormat)) { baseUrl = this.BuildDocumentPartialExportUrl(baseUrl) + exportFormat; } Uri queryUri = new Uri(baseUrl); return(base.Service.Query(queryUri)); }
public Stream Download(ITaskItem input, Document.DownloadType type, string baseDomain = null, int sheetNumber = 0) { input.LoadCustomMetadata(); Document.DocumentType documentType = input.RequireDocumentType(); Service s = this.Service; string queryUri = this.BuildDocumentPartialExportUrl(input.RequireExportUri()); switch (documentType) { case Document.DocumentType.Spreadsheet: s = this.Service; switch (type) { case Document.DownloadType.xls: queryUri += "xls"; break; case Document.DownloadType.csv: queryUri += "csv&gid=" + sheetNumber.ToString(); break; case Document.DownloadType.pdf: queryUri += "pdf"; break; case Document.DownloadType.ods: queryUri += "ods"; break; case Document.DownloadType.tsv: queryUri += "tsv&gid=" + sheetNumber.ToString(); ; break; case Document.DownloadType.html: queryUri += "html"; break; default: throw new ArgumentException("type is invalid for a spreadsheet"); } break; case Document.DocumentType.Presentation: switch (type) { case Document.DownloadType.swf: queryUri += "swf"; break; case Document.DownloadType.pdf: queryUri += "pdf"; break; case Document.DownloadType.ppt: queryUri += "ppt"; break; default: throw new ArgumentException("type is invalid for a presentation"); } break; case Document.DocumentType.Unknown: break; default: queryUri += type.ToString(); break; } Uri target = new Uri(queryUri); return s.Query(target); }
public Stream Download(ITaskItem input, Document.DownloadType type, string baseDomain = null, int sheetNumber = 0) { input.LoadCustomMetadata(); Document.DocumentType documentType = input.RequireDocumentType(); Service s = this.Service; string queryUri = this.BuildDocumentPartialExportUrl(input.RequireExportUri()); switch (documentType) { case Document.DocumentType.Spreadsheet: s = this.Service; switch (type) { case Document.DownloadType.xls: queryUri += "xls"; break; case Document.DownloadType.csv: queryUri += "csv&gid=" + sheetNumber.ToString(); break; case Document.DownloadType.pdf: queryUri += "pdf"; break; case Document.DownloadType.ods: queryUri += "ods"; break; case Document.DownloadType.tsv: queryUri += "tsv&gid=" + sheetNumber.ToString();; break; case Document.DownloadType.html: queryUri += "html"; break; default: throw new ArgumentException("type is invalid for a spreadsheet"); } break; case Document.DocumentType.Presentation: switch (type) { case Document.DownloadType.swf: queryUri += "swf"; break; case Document.DownloadType.pdf: queryUri += "pdf"; break; case Document.DownloadType.ppt: queryUri += "ppt"; break; default: throw new ArgumentException("type is invalid for a presentation"); } break; case Document.DocumentType.Unknown: break; default: queryUri += type.ToString(); break; } Uri target = new Uri(queryUri); return(s.Query(target)); }
public Stream Download(ITaskItem document, string exportFormat) { Document.DocumentType documentType = document.RequireDocumentType(); string baseUrl = document.RequireExportUri(); if (!string.IsNullOrEmpty(exportFormat)) { baseUrl = this.BuildDocumentPartialExportUrl(baseUrl) + exportFormat; } Uri queryUri = new Uri(baseUrl); return base.Service.Query(queryUri); }