Web API Folder to place template Reports (rpt, xml, etc.) - asp.net-mvc

I have my Web API project, and one its controllers will generate Reports on the fly (PDF, Excel, etc.)
In order to generate the Reports, I have the template files rpt (crystal reports), xml (componentone), etc. My question is where is the recommended folder to place those files.
Note. The generated report won't be saved on server, the controller will just response the stream to the client.

I would put them into "~/Content/Reports" and read from there.

Related

Generate a .zip file using Forge Design Automation

I'm working on a web site using Forge Design Automation for AutoCAD, and I'd like to have a .zip file returned. Does the .zip file have to go back to a URL (folder) located in site, or can it be downloaded directly to my view (MVC) through the controller? And, if it can come back to the view, how do provide arguments to my workitem?
Thank you.
The Design Automation will want to PUT/POST the resulting zip file somewhere. So you must supply a resource (URL) that can be operated on by one of those verbs.
Your website then can offer up the same resource to download to your clients. Clients cannot download directly from Design Automation as there's no HTTP resource that they could GET.
We can take advantage of the Forge OSS signed resource with read/write permission, so that Design Automation API will put the file to the Forge OSS bucket, and we can use the sample link to download the file. Please check my sample here. Although it's a Revit sample, the signed resource part can be applied to Design Automation API for AutoCAD, too.
https://github.com/yiskang/forge-revit-fbx-export-bim360/blob/master/routes/da4revit.js#L92
https://github.com/yiskang/forge-revit-fbx-export-bim360/blob/master/routes/da4revit.js#L216
https://github.com/yiskang/forge-revit-fbx-export-bim360/blob/master/public/js/ForgeDesignAutomation.js#L58
https://github.com/yiskang/forge-revit-fbx-export-bim360/blob/master/public/js/ForgeDesignAutomation.js#L220

Node.js - Download .docx file exported as html from onedrive using microsoftgraph api call

When making a call like this example from here
client
.api('/me/drive/root/children/Doc.docx/content')
.getStream((err, downloadStream) => {
let writeStream = fs.createWriteStream('Mydoc.docx');
downloadStream.pipe(writeStream).on('error', console.log);
});
It works as expected. What I want is to get the .docx file as html. Is there any way to download it in html format? Or do I have to save the file and then try to export it to html. Thanks
Word Documents (.docx) do not use HTML, they use Office Open XML (OOXML). Technically they are a zipped package that contains several elements along with the raw OOXML of the document.
OneDrive itself does not provide any document conversion tools, it is just the cloud storage the document is stored in.
In order to convert a document from one format to another (OOXML to HTML for example), you'll need to use a 3rd party tool or service for that purpose. I'd suggest taking a look as Aspose. They offer a slew of file format conversion tools including one for Word. I've had a number of developers report good results using their Aspose Cloud services as well.
You can add the query parameter format=html to download in html format but supposedly you have to use the beta endpoint.

Display docx or ppt in browser with ruby

I'm currently working on a intranet webapp for a company.
I've created it so the administrators of the site are able to upload files
(.docx, .pdf, .xlsx, .ppt etc) up to the webapp, to provide easier access
to documents for the employees. It works very well, however my client wasn't
too fond of having to download the files, and wanted it to pop up in the browser,
or open up the file-spesific program instead of download.
I was playing with some ideas:
1. Somehow parse the files to JSON at upload, and then show the content in browser with html.
2. Generate a pdf from the uploaded file (which automatically launches in the browser).
3. Somehow use a previewer to show the filecontent in the browser
4. Clients computer launches the uploaded file automatically on download, however I think this is a bit more tricky...
What would be the best and most time-efficient way to go about this?
It feels like what you actually want/need is a javascript document viewer (only) such as http://viewerjs.org/.

Download Directory and Contents

Is it possible to persuade the stream result to download an entire directory and it's contents? And if so, how? I've no problem getting it to download individual files, but I have a need to download a series of files that must be in a specific directory structure.
I don't think so.
Stream result allow you to download ONE content, with its MIME type, its name, etc.
This makes it impossible to work with a lot of files, with different names and content type.
What you can do is:
Render in a JSP the list of files (in anchor tags for example), everyone targeting the Action that will download that single file;
Call multiple Actions via scripting opening multiple pages (target="_blank") for every file you have (dangerous, annoying, almost useless...);
Create a zip with Java in server side, containing all your files and directories, then output the zip with Stream result.
I think you may consider the third option.

Adding server-side script and RSS feed to Sharepoint 2007?

I am investigating if the functionality of some CGI scripts written in Perl that we run on a web server can be migrated to our Sharepoint 2007 server (MOSS).
The CGI scripts are not complicated. Basically they display and process contents of files that resides in the network file system.
For instance one script just displays the contents of small text files that are being added to a specific folder.
These files are part of a production process and cannot be moved into a Sharepoint document archive.
The CGI scripts are being used to give an overview on what is "new in the queue" for this production process.
When the production process has finished, it removes the files from the folder. But new files may arrive to the folder at any time.
I have done some investigations and found that using a "Data View" web part would give possibilities of displaying the data in a good way.
The files need to be transformed from text to XML format, before some xslt could make it look good in a Data View WP. I guess that could be done by some kind of server-side script?
But how and where do I add such a script to Sharepoint?
Would it be a good idea implementing this as an RSS feed instead? But an RSS feed would also require a server-side script, wouldn't it?
I am new to Sharepoint development and would appreciate any useful advice.
Why not just write a Custom WebPart to read the content of those text files and display them. This way you wont be making changes to those text files.
Note : The link to custom Web Part is my blog. There are tonnes of other articles in the net :)

Resources