Annotation Control (or Document Control w/ Annotation Support) in .NET - c#

I am looking for a .NET library (or, more specifically, a .NET component) which allows me to write annotations to a document (not specifically a Word document - the component itself could display a document which I can also add annotations to). Even better would be something with similar functionality to the reviewing process in Microsoft Word, but I would be happy with just basic annotations.
I haven't been able to find anything very promising in Google searches, so I was wondering if SO would have any suggestions.
(Note: Unlike this question, my application is a standalone app and I am not looking to do this on the web.)

For those of you who might be looking, ScintillaNET supports annotations as well as markers (which is what I was looking for). The documentation is a little bit difficult to parse through (specifically the Scintilla documentation, which ScintillaNET comes from), but it is easy once you start getting the hang of it.
Hope this helps!

Related

ANTLR Syntax Highlighting DSL in Visual Studio

I have an ANTLR grammar that defines a DSL (domain specific language). This grammar is relatively simple. It is parsing the language and outputting C code to create a very basic translator.
This language is meant to be used in C# application (typed into some sort of control, whether it be RichTextBox or a custom control) and one requirement is to have syntax highlighting for this language. I have scoured the Internet in hopes of finding some sort of information on how to accomplish this, or find a tool to make this a little easier on myself.
After not finding too much information, my best assumption would be that I need to use the ANTLR generated lexer to look at the tokens and color them accordingly. Is this the correct path of action, or is there some other method/tool to provide syntax highlighting for custom domain specific languages? If this is the correct method, how do I go about recognizing specific tokens?
If I left out any important information, please ask! Thanks!
I successfully used AvalonEdit for a similar project of mine. I just created a small editor with the correct syntax highlighting.
It is very easy and quick to get it up and running in your project. You just have to provide it with a simple XML file to document the syntax of your DSL and you will have a colored output out-of-the-box as a WPF control.
It looks like they added completion facilities since I used it, I don't have experience on that part though, but I suspect it is also very well done if the quality is the same as the colouring.
This language is meant to be used in C# application (typed into some sort of control, whether it be RichTextBox or a custom control) and one requirement is to have syntax highlighting for this language.
Consider using Scintilla for your control. It's a text control for IDE-style text editing. Notepad++ uses it for its text control, as does the SciTE IDE from which it originates. I've used it in a small, custom IDE project written in C# using an unofficial .NET-specific version -- I think it was ScintillaNET.
Scintilla supports custom keyword highlighting and also a variety of programmable features like squiggly-line underlining and things like that.
If you have a control that you'd rather use, I think it's reasonable to use a small ANTLR lexer to produce tokens for you. Each token contains the line number, starting character position, source text, and token type -- everything you'd need to know what to highlight and how. The only hassle would be running the text through the lexer each time the text is changed. There are efficient ways to do that without re-lexing the entire document, but it's still something to keep in mind.

c#-doc-viewer for VisualStudio

c# offers a nice way to document your c#-code. But I don´t find any nice viewer. I search something like the java-doc-viewer in eclipse. This viewer allows you to browse in the java-doc just by moving your mouse over eg. a class-name.
Does someone know a good extension for Visual Studio 2010 that contains such a viewer?
I have the "Productivity Power Tools"-Extension installed. But it hasn´t a real doc-viewer either.
Edit:
Here is a picture of what I search:
And this is the best I can find for VisualStudio:
You try using CR_Documentor, if you don't mind installing Code Rush (alone for that purpose; you only need the free "DXCore" actually, checkout the project's homepage for more information).
Note that this tool doesn't require a prior generation of the documentation using tools like Sandcastle. It works by simply placing your cursor in a API comment block, e.g. that of a method.
Obviously, this has some drawbacks, for example, links to other items (e.g. <see/> or <seealso> will be rendered as a link, but don't work as such).
This is what it looks like:
I was using it once, way back when it was still maintained by the original author Lutz Roeder, and it did it's job well. I have not been using it since.
Update: You could also use ReSharper, which provides a "Quick Documentation" feature.
There isn't any built-in tool in VS for viewing the documentation of your code. You have to generate the documentation pages from the XML doc, using external tools.
Free tools:
Sandcastle is the most well known, it has a lot of features, but it doesn't seem to be maintained any more and it's quite difficult to use (although Sandcastle Help File Builder makes it significantly easier, and is still maintained).
docu is simpler to use, but not specific to .NET
Monodoc (from the Mono project)
Commercial tools:
VSdocman
Document! X
Doc-O-Matic
ForgeDoc: this one is quite new and looks very promising: very lightweight, simple to use, fast, good-looking output... It's also much cheaper than the others above
You can use NDoc to build the API documentation and generate help files (typically HTML files)
http://sourceforge.net/projects/ndoc/

Automatically convert a MindMap to another app (e.g. MS Project)

Here is the situation:
We ran a brainstorming session to find all the tasks we will have to achieve for our project
Now, I want to create a Gantt Planning (for instance) with all these tasks
We already built a MindMap with Xmind (I sometimes use Freemind too, or I could also export the Xmind to a Freemind format).
I would like to create a Gantt Planning in Microsoft Project (this is what we mainly use here).
My questions are:
Has anyone of you ever tried to automate the creation of a Gantt from the MindMap (using each level of the MindMap as Title and each leaf as Tasks)?
Would it be possible with VBA? Or C#? I didn't find much API to Xmind of Freemind, did I miss something?
If you can convert your mind map to Freemind, there is some documentation on the Freemind site which provides a couple of approaches to reformatting the Freemind file as an XML file which MS Project can read.
I maintain MPXJ, a library which can be used to read and write file formats which MS Project works with. I felt sure that someone had already written an add-on for Freemind which allowed you to export mind maps as a project plan using MPXJ... however I can't find a reference to it any more! If you don't mind a bit of coding (in Java, or any of the .Net languages) it wouldn't be too hard to achieve what you want using MPXJ.
Jon
We're doing exactly that with STOIC.

Editing Microsoft Word Documents Programmatically

I want to know if this could be done.
I am building a data dictionary for our software system (school project), and I'm thinking of an automated way to do this. Basically I don't use much of Microsoft Word (2007), I only use it in documenting schools stuff, etc. I want to know if its possible to create/edit a Word document programmatically from a template.
The idea is, I will create a page on Word that contains an empty form that will be repeated on every page. For every data that I will input to my program, it will update the corresponding field in the form and skips to the next form.
The purpose of this, is to eliminate copy-paste methods (my habit) and to speed things up when doing the documentation.
Word automation, as suggested by others, will lead you to a world of hurt for two major reasons:
Office is not intended to be run unattended, so it can pop up message boxes at any time, and
It is (probably) not licensed to enable office functionality for computers which don't have it. If you generate a Word document on a web site using automation, you have to make sure that this functionality cannot be reached by computers which don't have office installed (unless they changed this rule in the last years).
I have used Aspose.Words, it costs a little, but it works well and is intended for this.
Not exactly sure what you really want, but creating word documents with c# shouldn't be any problem:
http://support.microsoft.com/kb/316384
If i find out your purpose correctly you need to visit this microsoft msdn link
Manipulating Word 2007 Files with OpenXML
Definitely possible. A fairly easy way of doing it using Office Automation. See this KB article for a basic sample: How to automate Microsoft Word to create a new document by using Visual C#
I think the main difference to that sample will be that you'll open your template and do SaveAs instead of creating a new document, but I can't remember exactly.
However, depending on your exact requirements, there might be better alternatives. For example, it's not recommended to do Office Automation on servers (including on webservers), so if that's needed you might want to look at something else.
You can use com interop of .net framework.
Understanding the Word Object Model from a .NET Developer's Perspective
Building COM Objects in C#
Using COM programming is not the best way as mentioned by erikkallen, I suggest using OPEN XML. It is really easy to use and your document generation operation will be very fast.
http://blog.goyello.com/2009/08/21/how-to-generate-open-xml-file-in-c-in-4-minutes/
http://msdn.microsoft.com/en-us/library/aa338205(v=office.12).aspx

How to draw a base glyph with one color and its attached diacritic with another one?

MS Word has this capability in its Hebrew and Arabic versions. I would like to achieve this in a windows desktop application, using .Net (may be with win-api calls).
As explained in the link provided by Otaku here, current rich text edit controls can not handle this (unless you go for the hack OP in that Q did, which did not seem like a very good solution).
You could write code to do this manually yourself, ditching the text edit control completely, but that would probably mean a lot of work. It took Microsoft years to get support for combining diacritics working properly in MSWord. I would search for open source software that has this capability, and look at how other developers have done it. It might be hard to find, though, and you would likely have to step outside .NET-land. Maybe OpenOffice can do this?
This discussion might also be of help.
I am afraid that you will find, though, that you'll have to manually parse the Unicode and assign colors to the correct glyphs. If you want to be complete, that is one heck of a job.

Categories