This question already has answers here:
Visual Studio: Export C# Code into a PDF file and keep the formatting + colors?
(4 answers)
Closed 6 years ago.
I have a code that I need to put in a document for my coursework but I would like to keep all the formatting and line numbers. Is there any way of doing that?
Copy and paste it.
Ms Word will retain the formatting.
Other text editors might as well.
Related
This question already has answers here:
Display a PDF in WPF Application [closed]
(9 answers)
Closed 3 years ago.
I currently have an app in C#/WPF, and I have a manual on how to use it in pdf, and I'm thinking of adding a button that when clicked open the manual ... How can I do this?
Process.Start("C:\Temp\yourname.pdf");
replace the string "C:\Temp\yourname.pdf" with the path and filename for the pdf file you want to open.
This will cause the pdf to open in your systems default pdf application.
You will need: - using System.Diagnostics;
This question already has answers here:
How to read an entire file to a string using C#?
(17 answers)
Closed 5 years ago.
So I have this .json file: temp_file.json
Now all I need to do is get whatever is in this .json file, and put it in a string using C# in Visual Studio 2017.
That's it.
I don't want it to be turned into a object of a certain class or whatever. Just get whatsever in the file, right into a string.
A lot of other questions/answers I have stumbled upon are about desirializing and serializing etc. I don't need that. Just turn the .json file in to a string. No need to write it to a console or whatsoever.
Somewhy I just cant lay my finger on it. It sounds simple to do...
You dont get any simpler than
var contents = File.ReadAllText(#"drive:\path\to\yourfile.json");
This question already has answers here:
How can a Word document be created in C#? [closed]
(17 answers)
Generate Word document from c# [duplicate]
(3 answers)
Closed 9 years ago.
I have tried to look around for documentation on this subject, but I haven't really found a concrete answer. Just answers to problems that I am not really facing.
I want to pull some patterns and phrases from a database and generate a docx (or doc?) file in MS Word using C#. It's part of a school project. But the integration part doesn't seem to be very well documented, or I am looking in the wrong places.
Any help with this?
The magic word for google purposes is "Interop". Try this as a starting point:
http://www.dotnetperls.com/word
There are basically two ways to create word documents programmatically:
Create the documents by calling (and starting) word programmatically
Create the word document in the open XML format readable by Word.
For more info see similar questions here on stackoverflow:
How to create word docs programmatically from a template
Try use Open XML SDK 2.0 for Microsoft Office link
It provides easy way to work with docx file.
After words docx format is simple zipped xml file.
This question already has answers here:
C# hide and unhide comments
(6 answers)
Closed 9 years ago.
I am using the C# XML style of documentation in my latest project (eg using ///<summary> stuff). I find this makes the source code a pain to read as it just becomes so long. Is there a way in Visual Studio to auto-collapse just these or do I have to use the collapse to definitions and re-expand functions?
Take a look here at the following post, I think it should help
http://www.helixoft.com/blog/archives/30?n=collapse-all-xml-comments-in-vb-net-or-c
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How Is Syntax Highlighting Built?
I'm writing in C#. I have a simple RichTextBox, In which I'm writing in LaTeX.
Question:
How can I add LaTeX syntax highlighting in the box, so when I'm writing (in LaTeX syntax) the text will be highlighted?
RichTextBox does not natively support syntax highlighting. You will have to write your own or build on an existing one.