Exporting a GUI to XML? - c#

Is there a tool to take a GUI designed in C# or other languages that can take the screen layout and export that to an XML file such that you end up with a template of the screen in XML terms? As well as take an XML file and display the resulting screen?

Have you investigated XAML in WPF? You mention C#, so it seems like this is directly in line with what you're asking about.
http://en.wikipedia.org/wiki/XAML
Another good jumping off point might be this:
http://en.wikipedia.org/wiki/List_of_user_interface_markup_languages

XAML and XUL are designed to work in precisely this way. QT and Glade also offer this facility. However, they do not (as far as I know) offer any facility to reverse engineer a GUI that was not created with the layout tooling.
To use this type of tool you have to go from the form designer, which will save the form as a descriptor file. The toolkit will then offer various means (the exact method varies with the toolkit) to load the descriptor file and render the screen from it or use the descriptor as input into a code generator.

There is java.beans.XMLEncoder/XMLDecoder. But if you want to do that sort of thing, I think you are misguided.

Related

programatically create/manipulate visio drawing in vsdx file

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

A XML-enabled C# TextBox?

Visual Studio displays XML on a special text box which
Properly indents the XML hierarchy;
Angle brackets are blue;
Elements are brown;
Attributes are red;
Strings are blue
Comments are green.
Where can I get a special "TextBox" like this, in C#, which is specialized to display XML to use in my code?
Note I don't need a whole library with a lot of functionalities - all I need is a TextBox that display XML in different colors and indents.
Many thanks!
I don't think you'll find a simple textbox as it is rather complex to handle syntax highlighting. A good open-source solution for this that I have used in past is SharpDevelop from ICSharpCode. Part of the full IDE is a textbox-like control that you can use in your own application without the full-blown IDE.
Another option if you just want to display the XML, without editing, is to display the XML using the web browser, embedded as a user control. Not very light-weight, but definitely possible.
Have a look at these links:
Syncfusion --this is not free. It provides support for many languages (including XML). The URL explains how to achieve that.
There is another post at stack overflow discussing the same thing.

Programmatically find and replace text in pdf

I'm trying to create a web script that will allow me to alter PDF templates that I have uploaded and re-output them. I have tried Zend already which allows me to write to a PDF but that means leaving the PDF blank in certain space which is to primitive for what I need. PDFFlip was not any better.
We need to implement functionality so we can remove content from the PDF as well as remove and replace. I have looked at CAM::PDF and changepagestring.pl but I'm not sure it's up to the job. I was hard pressed to find any real usage examples and Perl is not a language I have used before.
This is for a web project but I am flexible with the language we use, ideally PHP or ASP.NET C# would be great. Preferably not Java unless there is no other way.
I should also point out that I looked through the FoxitReader SDK without any luck. I never tried to implement it but I found no mention of find and replace like functionality.
You can tinker with PDF text but it is not straight-forward just to search and replace. The text is designed as an end-file format not for easy editing. I wrote a blog post explaining some of the issues at http://pdf.jpedal.org/java-pdf-blog/bid/12670/PDF-text
May be as workaround it's better to hold and fill in templates in some format that is more convenient for editing? E.g., you can keep your templates as Microsoft Word templates and then export them to PDF after filling. This thread may be useful on this way.
PDF file format isn't quite appropriate for editing.
Alternatively, you may prepare your templates as PDFs containing form fields. In this case filling of form fields is common and well-known task and there a lot of pdf components for this.

Is there a way to replace a text in a PDF file with itextsharp?

I'm using itextsharp to generate the PDFs, but I need to change some text dynamically.
I know that it's possible to change if there's any AcroField, but my PDF doen's have any of it. It just has some pure texts and I need to change some of them.
Does anyone know how to do it?
Actually, I have a blog post on how to do it! But like IanGilham said, it depends on whether you have control over the original PDF. The basic idea is you setup a form on the page and replace the form fields with the text you want. (You can style the form so it doesn't look like a form)
If you don't have control over the PDF, let me know how to do it!
Here is a link to the full post:
Using a template to programmatically create PDFs with C# and iTextSharp
I haven't used itextsharp, but I have been using PDFNet SDK to explore the content of a large pile of PDFs for localisation over the last few weeks.
I would say that what you require is absolutely achievable, but how difficult it is will depend entirely on how much control you have over the quality of the files. In my case, the files can be constructed from any combination of images, text in any random order, tables, forms, paths, single pixel graphics and scanned pages, some of which are composed from hundreds of smaller images. Let's just say we're having fun with it.
In the PDFTron way of doing things, you would have to implement a viewer (sample available), and add some code over a text selection. Given the complexities of the format, it may be necessary to implement a simple editor in a secondary dialog with the ability to expand the selection to the next line (or whatever other fundamental object is used to make up text). The string could then be edited and applied by copying the entire page of the document into a new page, replacing the selected elements with your new string. You would probably have to do some mathematics to get this to work well though, as just about everything in PDF is located on the page by means of an affine transform.
Good luck. I'm sure there are people on here with some experience of itextsharp and PDF in general.
This question comes up from time to time on the mailing list. The same answer is given time and time again - NO. See this thread for the official answer from the person who created iText.
This question should be a FAQ on the itextsharp tag wiki.

C# - Templated Printing from Object(s)

I'm in need of a solution to print or export (pdf/doc) from C#. I want to be able to design a template with place holders, bind an object (or xml) to this template, and get out a finished document.
I'm not really sure if this is a reporting solution or not.
I also don't want to have to roll my own printing / graphics code -- I'd like all display concerns handled in a template.
I initially think of this as something Crystal Reports can do (although I've never used CR), but I'm not sure if I'm abusing the system here -- I'm not really interested in binding ADO.NET datasets at the moment (screw datasets). Can Crystal deal with binding to objects?
Does SSRS or WPF play in this field too?
A subset of WPF-P is XPS which can be used to present your objects via databinding.
One of the best choices if you are already using WPF.
Google Keywords: XPS, FixedDocument, FlowDocument, WPF Printing
Might read through this thread:
http://groups.google.com/group/nhusers/browse_thread/thread/e2c2b8f834ae7ea8
Seems a lot of people like iTextSharp
http://itextsharp.sourceforge.net/
For Word docs, look into Word's Mail Merge feature and Word automation. I did this recently in a form letter printing project. Basically what I did was create a Word template file (file extension .dot) and in this template file I defined MergeFields in a standard form letter. My application queries a database for the records it needs to print and then for each record it returns it matches fields in the database with these merge fields and sends the result (the merged doc) to the printer.
It's working really well and if I had a link that gave a definitive explanation, I'd provide it (check back here, I'll see if I can't find the most useful ones). Hopefully I've provided enough keywords to let you find your own resources. I can go into more detail if you need.
I've never had to export PDF files but for a project I'm working on now I'll have to. For a free solution my research has lead to iTextSharp (like Will Shaver points out) but I've only done the initial investigations and I have found a few pay solutions I might end up resorting to.

Categories