Host Office apps in a WPF Application - c#

I am currently working on a project that requires a text editor. All of the computers that will be running this app will have the whole office suite installed, more specifically Office365.
I started building my own text editor but it would take a lot of time to implement some QOL Microsoft Word has so I started looking up ways to somehow host Microsoft Word inside a WPF Window or at least make it look like it is docked. So far I have found stuff from 10+ years ago mentioning OLE and what not but I figured it is probably way outdated.
Can anyone here please point me in the right direction ?

You can't host Office365 product in your app, Microsoft does not offer such a service.
Since you want a text editor, you can look for off-the-shilf products like avalonEdit:TextEditor, download it via NuGet and use it in your view just like this..
<avalonEdit:TextEditor
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
Height="400"
FontFamily="Consolas"
FontSize="12pt" />
Another lovely open source WPF-based text editor is Notepads, but there is no ready-to-use usercontrol similar to avalonEdit:TextEditor. You have to include it in your solution as a class library then embed it in your windows application (can't predict how much effor/time can it take).

Related

Uno.Platform and Visual Studio

I am a C++ and python developer but I need to use C# for a professional project.
I know some good basics of .NET Core but I want to find a good UI library to learn.
I test Avalonia and I want to try Uno.Platform for is multi-platform capabilities.
But, I make simple test on Visual Studio and just try if it works on Windows (with UWP sub solution).
It works (thx for templates and tutorial) when I run the application from Visual Studio.
But I want to try the application directly by executing the App.exe generated in bin/x86/... but nothing append. No trace, no error... just nothing.
I try to deploy but the problem persist....
I probably miss something important but I found no information that can help me on internet.
Did you have information to help?
When kind of topic I don't understand in the C# with Uno.Platform CI?
This seems a pretty general question. The best way to go about it is to go to Uno Platform Discord community and chat with users there - www.platform.uno/discord - #uno-platform channel.
For specific questions on how to do X with Uno Platform you should post to Stack Overrlow.
hmm i will try to answer your question. i am also experimenting with Uno.
Since Uno is Crossplatform, every Operating systems Uses its own "Programm Header"
This Header contains a lot of stuff including the needed Code entrance Point for each OS.
For Windows i tried it with the WPF HOST header and it worked.
If you want to get a executabale for the "Hallo World" example try to publish the WPF HOST Header into a folder. it will contain the .exe

UWP File Picker Contract / Provider

I'm looking for a point in the right direction. We're thinking of building an app in our office, and one of the features we're looking at is to be able to open and save files from our app in other apps and applications.
We came across the File Picker Contract which, with some simple examples, seems to be what we're looking for. But the one thing missing is it only seems to be available in other Universal apps (but it doesn't seem all of them).
Using multiple examples, we were able to see our apps in our other apps, but I'm hoping to take it further. For example, I thought Office 2016 was a Universal app, so shouldn't File Picker Contract apps appear in there as well? And is there a way to add it globally to all File Open / Save Pickers (like from notepad, or the snipping tool)?
This MSDN page (article) seems to suggest the picker uses a single, unified interface. Shouldn't that be the same interface the rest of the operating system uses?
Thanks in advance.
If you have to support Classic Windows apps, filepickercontract is not a right solution. It's only applicable for 'modern'... Win8.1 store or Win10 UWP apps.
And, current office2016(for desktop) is not an UWP app, I believe. UWP ver of Office 2016 is only applicable for Win10 Mobile.
One alternative is make a shell extension. By using this, you can extend the explorer's shell space and add your own items to explorer tree. But shell extension is so complex, old and only applicable for desktop devicefamily. I don't think that now is a nice timing to implement it.
I hope this answer could help you.

Remote desktop connection in C#

I want to connect to a remote PC through my own app. I planned to make one in Visual Studio 2012.
I've searched around on the internet, and couldn't find the solution to make an remote connection inside of a form.
I've read something about the "Microsoft Terminal Services Control Type" Liberary (http://www.codeproject.com/Articles/43705/Remote-Desktop-using-C-NET), but i couldn't get it working.
Any help would be appreciated!
You can use this guide : http://www.codeproject.com/Articles/43705/Remote-Desktop-using-C-NET
It's a pretty outdated technology and only works on WinForms AFAIK. I tried using this control in one of my projects but decided to ditch it as I couldn't get it to resize dynamically.
Gaucomole is another good option. but is a bit more complex: http://guac-dev.org/doc/gug/writing-you-own-guacamole-app.html
It runs in a browser and uses HTML5.
EDIT: Just noticed the article I linked is the one you were using. Why couldn't you get it working?
As an alternative for C#, you can also try Myrtille. It was first a commercial application that I made open source recently. Like Guacamole, it works from a web browser (HTML4 and HTML5) in pure javascript (no plugin).
But, as Jonathan said, if you want the remote connection into a winform, you'd better use the Microsoft Terminal Services COM control.

Windows explorer integration like tortoisesvn

My company uses a flavour of GIT for moving source code from your local system to the repository at the desired location (which later deploys and stuff , its a server basically) and the support for that tool is BAD. It uses the commandline and its very tedious to use it . I want to build somthing similar to tortoiseSVN / tortoiseGIT for this purpose and i am looking for a starting point.
How would i get the overlay icons in the folder ?
How would i be able to do windows explorer integration in the "right" way ?
I'm going to use .Net C# to build this tool.
Thanks in advance for the help!
Cheers.
You can write a Shell Extension! There is a lot to learn, though. Part IX of the complete idiot's guide to shell extensions series explains how to deal with icons.
In general writing IE and Shell extensions in C# isn't supported. Of course, newer versions of the runtime do allow you more flexibility in the area of SxS support. But you're on your own in terms of writing the COM interop and you need to think very carefully about how this will effect other apps that do things like use the file-open dialog.

Howto draw "pages" in a C# WinForms project

I want to display data on a Windows Forms project in C#.
The general sketch for the GUI is similar to Acrobat Reader or MS Word - meaning i want to display the data on several pages, and let the user navigate between the pages. The data i`m displaying isn't special, i just want to give the user a "page" feeling when viewing it.
I`m searching for a good starting point, preferably open-source.
I thought about using some kind of a reporting tool, such as Crystal Reports, is that a good idea?
Also, is better to use WPF then WinForms for this?
Any thought and recommendations are welcome.
Thanks.
It sounds like you would be better off going the WPF route. You have MUCH better control over how your "form" looks.
What you would want to do is define each "page" in a user control or something, then you can display each one however you like. WPF can handle the zooming for you, all you have to do is hook it up (look into transforms). I can't see WinForms doing this. I would suggest looking at this project on codeplex.
If this project is just for fun, and if you already are using Visual Studio 2008, then WPF is a good choice for this.
If you intend to make this a commercial project, however, I would recommend making it a WinForms application. WPF requires Visual Studio 2008 and .Net 3.5. Many Windows users (especially corporate customers) are still using .Net 2.0 and don't plan to upgrade soon. Some are even still on .Net 1.1 (or no .Net at all). .Net 2.0 comes pre-installed now on new PCs, and the installer for 2.0 is only 23 MB (versus close to 200 MB for the somewhat-buggy .Net 3.5 installer). Also, .Net apps can (potentially) be made to run on Mac, Linux and the iPhone thanks to Mono, but Mono now is somewhere between .Net 2.0 and .Net 3.5, so WPF applications can't be cross-platform yet.
Here is a previous answer to a sort-of-similar question about doing a zoom effect in .Net with GDI+:
Auto sizing zoom on an image in .NET
This should give you a start on doing this kind of graphics work in .Net (and it's as open source as it gets).
Update: If you want to render XPS documents (easily), then you should use WPF. However, this choice would effectively eliminate the possibility of making your application cross-platform via Mono, at least in the short-term.
An alternative would be to export your documents as PDF files, or use Adobe Acrobat to convert your XPS documents into PDF files. Here is a link to a CodeProject sample that renders PDFs entirely in C#/.Net 2.0 or older:
http://www.codeproject.com/KB/showcase/pdfrasterizer.aspx
This code would allow your WinForms application to render a PDF file as a collection of Bitmaps (one for each page), and from there it's a relatively simple matter to display these Bitmaps in the manner you describe (with zoom and everything). Because the project would use .Net 2.0, it should work in Mono without any modifications.
TabControl doesn't do what you want?
It sounds like what your trying to do is make an application behave like a web page. Would just adding a WebBrowser control suffice ?

Categories