I use Open XML SDK tool to parse pptx-files. Now I am going to develop my own .NET library/tool to generate an image from a PowerPoint slide. Open XML SDK in principle is not for such tasks, and I do not know where to start research?.
maybe to solve it better to use another programming language, for example, C++ (I also know it) with some library?
or it may be necessary intermediate convert pptx into some another format, for example, HTML and only then to image?
I also tried to investigate Aspose.Slides and Spire.Presentation libraries' dependencies in NuGet to know what they use to an image generation, but these attempts did not succeed.
This looks like a good starting point: Presentation to image conversion
The cited versions are old, but the syntax is still the same: PPT slides to images
My mistake, I misunderstood the end goal.
Related
I read this interesting article by Microsoft. I learned that a Visio file is nothing more than a Zip file containing XML with all the information about the graph.
Playing around with the code from the same article I managed to explore a Visio file, getting XML nodes for the shapes I'm interested in, for example.
My purpose is to draw the graph itself! But my primary constraint is that the application must not rely on Visio installed in the client. So I should write pure C# to render the graph, or reference some DLLs that help me to draw the graph without having Visio installed.
On the same article, at the bottom of the page, there is a link to something called pkgVisio. A VB project that can explore and display the graph. The problem with that project is 1) It's in VB! 2) It references several DLLs that I don't know and that I don't know where to get from (AxMicrosoft.Office.Interop.VisOcx, Microsoft.Office.Interop.Visio, Microsoft.Office.Interop.VisOcx, Microsoft.Practices.EnterpriseLibrary.Common, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging)
I am looking for a way to develop a program that can render a Visio file, or, if exists, a simple project that does the same thing.
Any hint or help will be really appreciated,
thank you
I think if you have a real-world diagram, this task is more or less hopeless. Although Visio vsdx file is composed of XML files which are plain text, inside those XML files there are formulas. The problem is not reading XML file, the problem is building a rendering engine, which is in fact a "giant calculator", as has been noticed once by one of Visio creators. Means, as a rule, you won't actually find the coordinates of shapes to render inside those XML files, but rather the rules to calculate those coordinates.
So my recommendation would be: forget it or use the commercial package if you want to render Visio diagrams without Visio
The mentioned libraries are:
VisOcx - this is Visio drawing control, it is only installed together with Visio itself. Basically this is ActiveX wrapper control for embedding Visio into your application.
EnterpriseLibrary - This is the Microsoft Enterprise Library
I need to deploy a visio visualization programmatically. For the moment I just need to add sticky notes with the attributes: size, position, color, text on it and text alignment, but the solution should be expandable with further shapes in the future. The information about the shapes is stored in google cloud firestore database. I am quite open for any kind of solutions and code language, but if possible it would be great to run google cloud functions, which supports Node.js, Python, and Go, but I also read about supporting .NET, moreover it should be open source if possible.
I am totally not an experienced code developer, thus it would be great if you could provide some code examples. That's what I actually miss in all the documentation I found.
As far as I researched the Visio 2016 SDK would be interesting in this case. But I didn't find close examples as I need. F.e. this link shows how to replace text in a shape, or this link shows how to add a rectangular shape. But the explanation is rare...
I analyzed the visio file itself with master..XML, page..XML etc., but the amount of values is confusing. And this leads me to the question how the SDK will handle this? How can I define master shapes, how do I format them?
Another option would be the Apose.Diagram API, but I am not shure if the sticky note is supported. An example is provided here. Unfortunately it's commercial, but if there is no other option i would go for it.
Thanks for advice!
just as an information about the actual state: i kind of "solved it" with manually manipulating the vsdx. the vsdx is just a compressed zip-file with ending .vsdx. If you rename it to .zip, you will see many xml-files. the file page1.xml is the one important if you just need to place simple shapes without relations to each other.
In the page1.xml there are xml-parts named as , just manipulate & multiplicate these parts.
I didnt try the sdk yet, or an third-party solution like apose.diagram, but for the actual use case of visualizing objects in form of a rectangle its good enough
I am searching from last two days but did not find any thing.
My requirement is to create a document viewer in my web application (C#.Net) and I don't want to use any third party tool for this. Can I convert the files in image or PDF or in any common formate which can be easly render on web page. I also can not use Introp object.
Any help will be highly appreciated
You mention in one of your comments that you'd like to write all the code yourself but don't know where to start. Here's how I would go about it...
First, you'll need to familiarize yourself with the Microsoft Office Format specification. You can find that here (there's a link to the technical specification). Office documents are actually a .zip file with an XML file inside along with any binary data representing attachments. Just renamed a .docx file as .zip and you'll be able to open it up and see the XML and any other supporting documents inside (same is true for xlsx, etc...).
Then you'll need to become intimately familiar with either PDF or HTML, as your job now will be to convert the various Office document structure into PDF or HTML structure, being sure to respect page layout, margins, order, etc...
As others have said, this is a large task which is why third party tools exist today. Also, each third party toolset has it's limitation as this is really hard to "get right" in all situations and there will be edge cases that work for one document and not another (because maybe they didn't use Microsoft Word to save the .docx, maybe they used OpenOffice and OpenOffice interpreted the standard slightly differently...)
If you cannot use COM/Interop technologies in your solution, you can take a look at the specialized 3rd party options. I see that you prefer not to use them, however, there are no existing built-in solutions in the .NET Framework. Check out my answer in a similar thread that describes how to accomplish exactly the same task using 3rd party libraries (for example, DevExpress, since I have experience with it). In addition, take a look at the Documents demo, where you can see how to create images/thumbnails from different types of MS Office documents.
I believe what you need is an intermediate representation of the documents which can be converted into an image for the viewer to display.
Lets me try to explain with the below diagram:
You can use tools like smallpdf or OfficeToPDF to do that. Just integrate them into your application.
Small PDF(https://smallpdf.com/library-detail)
officetopdf (https://officetopdf.codeplex.com/)
Is there a way to programmatically create PowerPoint presentations? If possible, I'd like to use C# and create PowerPoint 2003 presentations.
Yes, you can.
You will want to look into MSDN which has a pretty good introduction to it.
I might give you a word of warning, Microsoft Office interop is compatible with an API which is now more than 10 years old. Because of this, it is downright nasty to use sometimes. If you have the money to invest in a good book or two, I think it would be money well spent.
Here's a starting point for you. Use the search feature on MSDN MSDN Webpage. It's good for any Microsoft C# .NET style stuff.
Specifically in regards to your question, this link should help: Automate PowerPoint from C#. EDIT LINK NOW DEAD :(. These two links are fairly close to the original KB article:
Automate Powerpoint from C# 1/2
Automate Powerpoint from C# 2/2
Finally, to whoever downvoted this: We were all learning one day, how to do something as a beginner is most definitely programming related, regardless of how new someone might be.
OpenXML looks like the way to go from a web app.
Using the interop libraries is not recommended, as others have stated.
You can also look at Aspose Slides, a component for .NET and Java that makes it easy to generate powerpoint documents.
If you don't really need PowerPoint compatible output, consider using a markup language such as LaTeX with the Beamer package to produce a PDF of the presentation, or use HTML and javascript in a manner similar to Slidy. If you need fancy effects, it might still be easier to use SVG, and you'd have the benefit of getting output that can be reliably viewed with free software.
http://msdn.microsoft.com/hi-in/magazine/cc163471(en-us).aspx
Use this link. Although this is in VB.NET, C# supports the same.
You may also try out SlideMight, a tool for merging hierarchical data with PowerPoint templates.
SlideMight supports:
text substitution in text fields, tables and notes
image substitution, from raw data, files and URLs
images in tables nested
iterations over data to create slides
iterations to populate tables, possibly spanning multiple slides
special formatting for specific cell values
hyperlinks to generated slides
Input data format is at this time just JSON.
There are versions for Windows and Mac OS X.
More information is at http://www.SlideMight.com
Disclaimer:
I am the owner of Delftware Technology, the company that developed SlideMight.
And I am one of the developers.
You can use Essential Presentation product from Syncfusion Software Private Limited. This product can be used to
Create and manipulate PowerPoint presentations
Open, modify, and save existing PowerPoint presentations
Convert PowerPoint presentations to PDF or Image
More information is at https://help.syncfusion.com/file-formats/presentation/overview
Disclaimer:
I work for Syncfusion Software Private Limited
i need to convert bulk of pdf documents into non-editable format(scanned) some one help me to achieve this using C#.net
Assuming that Chris's comment is correct and you're trying to convert PDF docs to pictures, I'd suggest taking a look at ImageMagick.NET which is a .Net wrapper around ImageMagick which is an open source library for doing things like that.
Never used it myself, but it looks interesting.