Skip to main content

Export DOCX to PDF

This is a simple code to convert any Word document to a PDF using the Word interop. using Word = Microsoft.Office.Interop.Word; … public Word.Document wordDocument { get; set; } public void ConvertWord2PDF() { var appWord = new Word.Application(); wordDocument = appWord.Documents.Open(@”D:\Tests\test.docx”); wordDocument.ExportAsFixedFormat(@”D:\Tests\test.pdf”, Word.WdExportFormat.wdExportFormatPDF); }  

Use a Dictionary

Here is a simple example of how to use a Dictionary with a Key-Value. var dico = new Dictionary<int, string>(); dico.Add(1, “Steeve”); dico.Add(2, “Morgan”); var result = dico.FirstOrDefault(x => x.Key == 1); var temp = result.Value; //temp = “Steeve”  

Tools For Angular

Different useful tools to develop AngularJS apps. Notepad++ simply the best free open source text editor. Sublime Text 3 Chrome developer tool – out of the box (just right click then Inspect Element). AngularJS Batarang Chrome extension: useful to debug our application. JetBrains Webstorm IDE: according to me the best JavaScript editor.

AJAX

AJAX (Asynchronous Javascript And Xml) = a methodology employing DOM in combination with techniques for retrieving data without reloading a page. <!DOCTYPE html> <html> <body> <div id=”demo”><h2>Let AJAX change this text</h2></div> <button type=”button” onclick=”loadDoc()”>Change Content</button> <script> function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == […]

SaveFileDiaglog

Here is a simple example of how to use the native SaveFileDialog. var sfd = new SaveFileDialog { Filter = “PDF Documents|*.pdf”, DefaultExt = “.pdf”, FileName = “converted.pdf” }; // Show save file dialog box var result = sfd.ShowDialog(); // Get the location of the file if (result != true) return; var fileName = sfd.FileName; […]

Consume XML From A WebService

I will present two ways of getting an XML from a WebService and then read it as object(s). The first one will use validation. To validate an XML we generally use a XSD. This XSD can be provided in the XML it self as a reference or not (like in this case). The XSD is really usefull […]