Document Download Specific format

Hi ,


I want to download file as file format like (.docx)
It is working file with stream if DownloadPdfFileIfPossible(false) properties.
But It is not working with Streams

using this code

@(Html.ViewerClientCode()
.TargetElementSelector("#CtlGDThumbview")
.Streams(ViewBag.streamDefinitions, ViewBag.Filename)
.ZoomToFitWidth()
.ShowHeader(true)
.UseHtmlBasedEngine(true)
.UseInnerThumbnails()
.ShowDownload(true)
.ShowPrint(false)
.DownloadPdfFileIfPossible(false)

.ShowFolderBrowser(false)
)


Could you plz give me any solution asap.

Thanks
Jay

Hello Jay,


We are sorry to hear that you have such issue. Please try to add third property in the .Stream() option. It should be file extension, for example:
.Stream(this.fs, this.name, “docx”, this.name, true, null)

Code behind:
public FileStream fs = null;
public string name = “1.docx”;
string path = Server.MapPath("~/testfiles/" + name);
fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
fs.Position = 0;

Best regards.

Hi ,


I am using Group Doc Viewer version -2.15.1.11034

It is not working with stream.
It’s working with only strams.

using this code

StreamDefinition[] streamDefinitions = new StreamDefinition[1];
streamDefinitions[0] = new StreamDefinition
{
Stream = new MemoryStream(doc.FileContent),
FilenameExtension = “docx”
};

Thanks
Jay

Hello Jay,


Please download and investigate this sample . It will show you how to use Stream and download file in same type as it is.

Best regards.