title: Formatting Cell in a generated Word document
body: <p>I am generating invoices from within my LightSwitch billing application, and after an invoice is generated, the SubTotal, SalesTax and Total Due cells in the Word document are not of the correct format.</p>
  
  <p>I have gone through every single menu option, and explored other <em>possible</em> ways to have it formatted before it gets put in the document's Content control, but I just can't get the right format.</p>
  
  <p>The numbers are being displayed as <code>4100.0000</code>, but they should be like <code>4,100.00</code> or at least like <code>4100.00</code>.</p>
  
  <p>How can this be done?</p>
  
  <p>I realise that this is borderline off-topic, but I figured I'd post here anyway <em>as I believe the solution involves writing code, as opposed to using Word to accomplish this, because I have gone through all the options, and there just doesn't seem to be an option in there to change formatting for a single cell.</em></p>
  
  <p><img src="https://i.stack.imgur.com/Ex0SL.png" alt="enter image description here"></p>
  
  <p>As requested, code for document generation:</p>
  
  <pre><code>using System;
  using System.Linq;
  using System.IO;
  using System.IO.IsolatedStorage;
  using System.Collections.Generic;
  using Microsoft.LightSwitch;
  using Microsoft.LightSwitch.Framework.Client;
  using Microsoft.LightSwitch.Presentation;
  using Microsoft.LightSwitch.Presentation.Extensions;
  using OfficeIntegration;
  namespace LightSwitchApplication
  {
      public partial class Billing
      {
          partial void GenerateInvoice_Execute()
          {
              var mappings = new List&lt;ColumnMapping&gt;();
  
              mappings.Add(new ColumnMapping("InvoiceId", "InvoiceId"));
              mappings.Add(new ColumnMapping("DateGenerated", "DateGenerated"));
  
              mappings.Add(new ColumnMapping("InvoiceDataGridSubTotal", "SubTotal"));
              mappings.Add(new ColumnMapping("InvoiceDataGridSalesTax", "Tax"));
              mappings.Add(new ColumnMapping("InvoiceDataGridDateDue", "DateDue"));
              mappings.Add(new ColumnMapping("InvoiceDataGridTotalDue", "Total"));
  
              object doc;
              string path = @"C:\Users\Jason\Documents\SV Invoice.docx";
  
              doc = OfficeIntegration.Word.GenerateDocument(path, this.BillingTables.SelectedItem, mappings);
          }
      }
  }
  </code></pre>