|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using GeneratingMicrosoftWordReports.Reports;
namespace GeneratingMicrosoftWordReports.Transformer
{
/// <summary>
/// Demonstrates usage of GeneratingMicrosoftWordReports.Reports class library
/// </summary>
class Program
{
private static string _outputPath = @"c:\test.doc";
static void Main(string[] args)
{
// Populate report using data and return it as byte array
//byte[] wordDoc = Report.WordGeneratedInvoice();
byte[] wordDoc = Report.WordGeneratedInvoice();
// Write resulting array to HDD, show process information
using (FileStream fs = new FileStream(_outputPath, FileMode.Create))
fs.Write(wordDoc, 0, wordDoc.Length);
Console.WriteLine("Saved to: {0}", _outputPath);
Console.WriteLine("\nPress any key to continue");
Console.ReadKey();
// Display resulting report in Word
Process.Start(new ProcessStartInfo(_outputPath));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
If you liked this article, consider reading
other articles by me. For republishing article on other websites, please contact me by leaving a comment.