Example #1
0
        private BaseSectionControl GetSectionControl(Screen screen, Section section, string ResourceKeyPrefix)
        {
            BaseSectionControl sectionControl = null;
            SectionType        sectionType    = SectionType.GetSectionType(section);

            if (sectionType != null)
            {
                if (!String.IsNullOrEmpty(sectionType.Assembly) && !String.IsNullOrEmpty(sectionType.Class))
                {
                    sectionControl = (BaseSectionControl)Activator.CreateInstance(sectionType.Assembly, sectionType.Class).Unwrap();
                }


                if (sectionControl != null)
                {
                    sectionControl.Screen            = screen;
                    sectionControl.Section           = section;
                    sectionControl.ResourceKeyPrefix = ResourceKeyPrefix;

                    sectionControl.RenderControl();
                }
            }

            return(sectionControl);
        }
Example #2
0
 private ObjectNodeSection(string name, SectionType type, SectionAttributes attributes, string comdatName)
 {
     Name = name;
     Type = type;
     Attributes = attributes;
     ComdatName = comdatName;
 }
 public Section(int index, string text, SectionType type, DirectiveValues values)
 {
     Index  = index;
     Text   = text;
     Type   = type;
     Values = values;
 }
Example #4
0
        static char GetSymbolSection(SectionType sectionType, bool isDestroy)
        {
            switch (sectionType)
            {
            case SectionType.BrickWall when !isDestroy:
                return('+');

            case SectionType.BrickWall when isDestroy:
                return('-');

            case SectionType.IronWall:
                return('#');

            case SectionType.Road:
                return('=');

            case SectionType.Water:
                return('~');

            case SectionType.Grass:
                return('`');

            default:
                throw new NotSupportedException("Данный тип секции не поддерживается");
            }
        }
Example #5
0
        public List <ArticleResponseModel> GetStoriesBySection(SectionType sectionType, Func <Result, bool> condition)
        {
            sectionType.ThrowIfDefault(nameof(sectionType));
            condition.ThrowIfNull(nameof(condition));

            return(GetStoriesBySectionAndFilter(sectionType, condition));
        }
Example #6
0
        /// <summary>
        /// Reads and completes section contents
        /// </summary>
        /// <param name="sectionType"></param>
        /// <param name="bnkReader"></param>
        private void _ReadSection(SectionType sectionType, BinaryReader bnkReader)
        {
            if (bnkReader == null)
            {
                return;
            }

            Section section = _GetSection(sectionType);

            bnkReader.BaseStream.Seek(section.address, SeekOrigin.Begin);

            // FileData section has no length info
            if (SectionType.FileData == section.sectionType)
            {
                section.usableSize = (Size - section.address);
            }
            else
            {
                section.usableSize = bnkReader.ReadUInt32();

                // Checksum: 4 bytes - ignored
                bnkReader.BaseStream.Seek(0x4, SeekOrigin.Current);
            }

            if (section.IsEmpty)
            {
                return;
            }

            // Données : taille variable
            section.data = bnkReader.ReadBytes((int)section.usableSize);

            // Deep reading
            _ReadSectionData(section);
        }
Example #7
0
        public bool CanExecuteSection(string userName, SectionType sectionType)
        {
            if (sectionType == SectionType.One)
            {
                return(true);
            }

            SectionType previousSectionType = sectionType - 1;

            IEnumerable <ReportInstance> reports = DatabaseManager.Instance.UserReports(
                DatabaseManager.Instance.CurrentUsername);

            if (reports == null || reports.Count() == 0)
            {
                return(false);
            }

            var sectionOne = reports
                             .Where(report => report.SectionType == previousSectionType);

            if (sectionOne == null || sectionOne.Count() == 0)
            {
                return(false);
            }

            return(true);
        }
        private static Chunk GenericChunkFactory <T>(SectionType sectionType, Chunk parent) where T : Chunk, new()
        {
            Chunk result = new T();

            result.SectionType = sectionType;
            return(result);
        }
Example #9
0
        public override int GetHashCode()
        {
            int result = ElementId != null?ElementId.GetHashCode() : 0;

            result = 31 * result + SectionType.GetHashCode();
            return(result);
        }
Example #10
0
    public void Reset()
    {
        int seed = int.Parse(_seed);

        for (int i = 0; i < _levelSections.Count; i++)
        {
            Destroy(_levelSections[i].gameObject);
        }

        _levelSections.Clear();
        _cameraWaypoints.Clear();
        _pressureWayoints.Clear();


        CinemachineSmoothPath.Waypoint newWaypoint = new CinemachineSmoothPath.Waypoint();
        newWaypoint.position = new Vector3(_pressureStartPosition.x, _pressureStartPosition.y, CameraDistance);
        _cameraWaypoints.Add(newWaypoint);
        OnCameraWaypointsChanged(_cameraWaypoints);

        _nextSection = SectionType.START_SECTION;
        Pressure.transform.position = _pressureStartPosition;
        Pressure.transform.rotation = _pressureStartRotation;
        _pseudoRandom = new System.Random(seed);

        LoadSection();
    }
        private void ParseStruct(SectionHeader header, SectionType parent)
        {
            switch (parent)
            {
            case SectionType.Geometry:
                ParseGeometry(header);
                break;

            case SectionType.Material:
                ParseMaterial();
                break;

            case SectionType.FrameList:
                ParseFramesList();
                break;

            case SectionType.Atomic:
                ParseAtomic();
                break;

            default:
                reader.SkipStream(header.Size);
                break;
            }
        }
Example #12
0
        private bool WriteSection(SectionType type, SectionBase section, BinaryWriter bw)
        {
            //Write section type
            bw.Write((byte)type);

            //Reserve space for section length
            long sectLenPos = bw.BaseStream.Position;

            bw.Write(int.MinValue);

            //Write the section
            bool opCompleted = section.WriteSection(bw);

            //Check if something was wrong
            int sectionSize = (int)(bw.BaseStream.Position - sectLenPos - sizeof(int));

            if (!opCompleted || sectionSize == 0)
            {
                return(false);
            }

            //Update section size
            bw.BaseStream.Seek(sectLenPos, SeekOrigin.Begin);
            bw.Write(sectionSize);
            bw.BaseStream.Seek(0, SeekOrigin.End);

            return(true);
        }
Example #13
0
        public Script(Resource res, bool translated)
        {
            Resource    = res;
            _translated = translated;

            SourceData = res.GetContent(translated);

            ushort i = 0;

            while (i < SourceData.Length)
            {
                SectionType type = (SectionType)Helpers.GetUShortBE(SourceData, i);
                if (type == SectionType.None)
                {
                    break;
                }

                ushort size = (ushort)(Helpers.GetUShortBE(SourceData, i + 2) - 4);
                i += 4;

                Section sec = Section.Create(this, type, SourceData, i, size);
                Sections.Add(sec);
                i += size;

                if (sec is StringSection)
                {
                    _strings = (StringSection)sec;
                }
            }

            foreach (var sec in Sections)
            {
                sec.SetupByOffset();
            }
        }
Example #14
0
        /// <summary>
        /// Section Constructor
        /// </summary>
        /// <param name="ribbon">the Ribbon that this Section was created by and is a part of</param>
        /// <param name="id">Component id of the Secton</param>
        /// <param name="type">type of the section</param>
        internal Section(SPRibbon ribbon, string id, SectionType type, SectionAlignment alignment)
            : base(ribbon, id, "", "")
        {
            _type = type;
            _alignment = alignment;

            switch (type)
            {
                case SectionType.ThreeRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    AddChildInternal(new Row(ribbon, id + "-1"), false);
                    AddChildInternal(new Row(ribbon, id + "-2"), false);
                    break;
                case SectionType.TwoRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    AddChildInternal(new Row(ribbon, id + "-1"), false);
                    break;
                case SectionType.OneRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    break;
                case SectionType.Divider:
                    break;
                default:
                    throw new ArgumentException("Invalid SectionType");
            }
        }
Example #15
0
 /// <summary>
 /// Creates a new section as part of an intermediate.
 /// </summary>
 /// <param name="id">Identifier for section.</param>
 /// <param name="type">Type of section.</param>
 /// <param name="codepage">Codepage for resulting database.</param>
 public IntermediateSection(string id, SectionType type, int codepage)
 {
     this.Id       = id;
     this.Type     = type;
     this.Codepage = codepage;
     this.Symbols  = new List <IntermediateSymbol>();
 }
Example #16
0
        protected bool ParseSectionType(BinaryReader inputReader, SectionType type)
        {
            Section section = GetSection(type);

            if (section.IsNull())
            {
                return(false);
            }

            inputReader.BaseStream.Seek(section.Offset, SeekOrigin.Begin);

            Console.Write("\t\tParsing {0} section...", section.Type);

            bool result = ParseSection(inputReader, section);

            if (!result)
            {
                Console.WriteLine(" Error.");
            }
            else
            {
                Console.WriteLine(" Done!");
            }

            return(result);
        }
Example #17
0
        /// <summary>
        /// dump SectionData to comma delimited.
        /// </summary>
        /// <param name="sw">exporting file stream</param>
        /// <param name="psView">the PanelScheduleView instance is exporting.</param>
        /// <param name="sectionType">which section is exporting, it can be Header, Body, Summary or Footer.</param>
        private void DumpSectionData(StreamWriter sw, PanelScheduleView psView, SectionType sectionType)
        {
            int nRows_Section = 0;
            int nCols_Section = 0;

            getNumberOfRowsAndColumns(m_psView.Document, m_psView, sectionType, ref nRows_Section, ref nCols_Section);

            for (int ii = 0; ii < nRows_Section; ++ii)
            {
                StringBuilder oneRow = new StringBuilder();
                for (int jj = 0; jj < nCols_Section; ++jj)
                {
                    try
                    {
                        oneRow.AppendFormat("{0},", m_psView.GetCellText(sectionType, ii, jj));
                    }
                    catch (Exception)
                    {
                        // do nothing.
                    }
                }

                sw.WriteLine(oneRow.ToString());
            }
        }
Example #18
0
 public void setGlue(int start)
 {
     m_id    = -1;
     m_start = start;
     m_end   = start;
     m_type  = SectionType.Glue;
 }
Example #19
0
 public Section(SectionType type, int number)
 {
     Type = type;
     Number = number;
     Cells = new List<Cell>(9);
     CreateCells();
 }
Example #20
0
 public Book(string title, string authors, int publicationYear, SectionType section)
 {
     Title           = title;
     Authors         = authors;
     PublicationYear = publicationYear;
     Section         = section;
 }
Example #21
0
        /* Function: GetTokensInSection
         * Returns the bounds of the first stretch of tokens of the specified type appearing within the passed section.
         */
        protected bool GetTokensInSection(SectionType sectionType, int sectionIndex, ClassPrototypeParsingType tokenType,
                                          out TokenIterator start, out TokenIterator end)
        {
            TokenIterator sectionStart, sectionEnd;

            GetSectionBounds(sectionType, sectionIndex, out sectionStart, out sectionEnd);

            start = sectionStart;

            while (start.IsInBounds &&
                   start < sectionEnd &&
                   start.ClassPrototypeParsingType != tokenType)
            {
                start.Next();
            }

            end = start;

            while (end < sectionEnd &&
                   end.ClassPrototypeParsingType == tokenType)
            {
                end.Next();
            }

            return(end > start);
        }
Example #22
0
 public JsonNetConfigurationSection(IConfiguration root, IConfigurationElement parent, JToken node, string key,
                                    SectionType type) :
     base(root, parent, node, type)
 {
     GuardPath(key);
     Key = key;
 }
Example #23
0
        /// <summary>
        /// Настройки параграфа с разрывом
        /// </summary>
        /// <param name="body"></param>
        /// <param name="mainDocument"></param>
        public void SettingParagraph(ref Body body, MainDocumentPart mainDocument)
        {
            Paragraph           paragraph           = new Paragraph();
            ParagraphProperties paragraphProperties = new ParagraphProperties();

            SectionProperties sectionProperties = new SectionProperties();
            FooterReference   footerReference   = new FooterReference()
            {
                Type = HeaderFooterValues.Default, Id = mainDocument.GetIdOfPart(mainDocument.FooterParts.FirstOrDefault())
            };
            SectionType sectionType = new SectionType()
            {
                Val = SectionMarkValues.Continuous
            };
            PageMargin pageMargin = new PageMargin()
            {
                Top = 1440, Right = 700U, Bottom = -1400, Left = 1470U, Header = 710U, Footer = 700U, Gutter = 0U
            };

            sectionProperties.Append(footerReference);
            sectionProperties.Append(sectionType);
            sectionProperties.Append(pageMargin);
            paragraphProperties.Append(sectionProperties);
            paragraph.Append(paragraphProperties);
            body.Append(paragraph);
        }
        public void GetValue(SectionType sectionType, String genericSectionName, string involvementType, string orgInvolvementType)
        {
            //Arrange
            if (involvementType != string.Empty)
            {
                fixtures.citationSummary.Others.Clear();
                fixtures.citationSummary.Others.Add(new CitationPersonOther());
                fixtures.citationSummary.Others[0].InvolvementType = new CodeValue(involvementType, "");
            }

            if (orgInvolvementType != string.Empty)
            {
                fixtures.citationSummary.CitationOrganizations.Clear();
                fixtures.citationSummary.CitationOrganizations.Add(new CitationOrganization());
                fixtures.citationSummary.CitationOrganizations[0].InvolvementType = new CodeValue(orgInvolvementType, "");
            }

            fixtures.fakes.citationSummaryQueryService.Setup(m => m.FindCitationSummary(It.IsAny <Guid>())).Returns(fixtures.citationSummary);
            fixtures.template.Sections.First().SectionType = sectionType;
            fixtures.template.Sections.First().Name        = genericSectionName;

            //Act
            fixtures.citationSummaryBuilder.GetValue(Guid.NewGuid(), fixtures.template, fixtures.reportsData);

            //Assert
            fixtures.fakes.reportHeaderBuilder.Verify(mock => mock.GenerateReportHeader(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>(), It.IsAny <IReportsData>(), It.IsAny <FieldReportDisplayType>(), It.IsAny <FieldReportDisplayType>()), Times.Once);
            fixtures.fakes.attachmentBuilder.Verify(mock => mock.ReadAttachments(It.IsAny <List <Attachment> >(), It.IsAny <IReportsData>()), Times.Once);
        }
Example #25
0
 public ReadLineResult ReadLine(out SectionType secType, out string line, out string key, out IValue value)
 {
     secType = SectionType.None;
     line = string.Empty;
     key = string.Empty;
     value = null;
     if (streamReader == null)
     {
         return ReadLineResult.Error;
     }
     line = streamReader.ReadLine();
     if (line == null)
     {
         return ReadLineResult.Null;
     }
     if (line == string.Empty)
     {
         return ReadLineResult.OK;
     }
     string trimmedLine = line.Trim();
     if (trimmedLine == string.Empty)
     {
         secType = SectionType.Spaces;
         return ReadLineResult.OK;
     }
     // line = trimmedLine;
     return this.ParseLine(trimmedLine, ref secType, out key, out value);
 }
Example #26
0
        public Dictionary <string, List <ESection> > GetWebSection(SectionType sectionType)
        {
            var list   = _bookDb.GetWebSection(sectionType).Result;
            var result = new Dictionary <string, List <ESection> >();

            //  Enum.GetNames()
            string[] secNames = Enum.GetNames(typeof(SectionType));
            foreach (var sec in secNames)
            {
                if (sec != "All")
                {
                    result[sec] = new List <ESection>();
                }
            }

            //     result["Column"] = new List<ESection>();
            if (list.Count > 0)
            {
                if (sectionType == SectionType.All)
                {
                    foreach (var st in list)
                    {
                        var secName = st.SectionType.ToString();
                        result[secName].Add(st);
                    }
                }
                else
                {
                    var secName = list[0].SectionType.ToString();
                    result[secName] = list;
                }
            }

            return(result);
        }
Example #27
0
    private void LoadSection()
    {
        Vector3 oldSectionPosition;

        LevelSectionController newSection = Instantiate(LevelSections.Find(x => x.Section == _nextSection), transform);

        _levelSections.Add(newSection);
        if (newSection.Section != SectionType.START_SECTION)
        {
            oldSectionPosition            = _levelSections[_levelSections.Count - 2].transform.position;
            newSection.transform.position = new Vector3(oldSectionPosition.x + _levelSections[_levelSections.Count - 2].OffsetX,
                                                        oldSectionPosition.y + _levelSections[_levelSections.Count - 2].OffsetY,
                                                        0.0f);
        }

        CinemachineSmoothPath.Waypoint newWaypoint = new CinemachineSmoothPath.Waypoint();
        newWaypoint.position = new Vector3(newSection.CameraPathPoint.transform.position.x, newSection.CameraPathPoint.transform.position.y, CameraDistance);
        _cameraWaypoints.Add(newWaypoint);
        OnCameraWaypointsChanged(_cameraWaypoints);

        _pressureWayoints.Add(new Vector3(newSection.CameraPathPoint.transform.position.x, newSection.CameraPathPoint.transform.position.y, 0.0f));
        _pressureWayoints.Add(newSection.PressurePathPoint.transform.position);

        List <SectionType> possibleNextSections = newSection.PossibleNextSections;

        _nextSection = possibleNextSections[_pseudoRandom.Next(0, possibleNextSections.Count - 1)];
    }
Example #28
0
 public void setOne(int start, int end)
 {
     m_id    = -1;
     m_start = start;
     m_end   = end;
     m_type  = SectionType.One;
 }
Example #29
0
 public void setData(int start, int end)
 {
     m_id    = -1;
     m_start = start;
     m_end   = end;
     m_type  = SectionType.Data;
 }
Example #30
0
        private static string DefaultExtensionForSectionType(SectionType sectionType)
        {
            switch (sectionType)
            {
            case SectionType.Bundle:
                return(".exe");

            case SectionType.Module:
                return(".msm");

            case SectionType.Product:
                return(".msi");

            case SectionType.PatchCreation:
                return(".pcp");

            case SectionType.Patch:
                return(".msp");

            case SectionType.Fragment:
            case SectionType.Unknown:
            default:
                return(".wix");
            }
        }
Example #31
0
 public LpcWindowSection(int end)
 {
     m_id    = -1;
     m_start = 0;
     m_end   = end;
     m_type  = SectionType.Data;
 }
Example #32
0
 public void setZero(int start, int end)
 {
     m_id    = -1;
     m_start = start;
     m_end   = end;
     m_type  = SectionType.Zero;
 }
Example #33
0
        /// <summary>
        /// Section Constructor
        /// </summary>
        /// <param name="ribbon">the Ribbon that this Section was created by and is a part of</param>
        /// <param name="id">Component id of the Secton</param>
        /// <param name="type">type of the section</param>
        internal Section(SPRibbon ribbon, string id, SectionType type, SectionAlignment alignment)
            : base(ribbon, id, "", "")
        {
            _type      = type;
            _alignment = alignment;

            switch (type)
            {
            case SectionType.ThreeRow:
                AddChildInternal(new Row(ribbon, id + "-0"), false);
                AddChildInternal(new Row(ribbon, id + "-1"), false);
                AddChildInternal(new Row(ribbon, id + "-2"), false);
                break;

            case SectionType.TwoRow:
                AddChildInternal(new Row(ribbon, id + "-0"), false);
                AddChildInternal(new Row(ribbon, id + "-1"), false);
                break;

            case SectionType.OneRow:
                AddChildInternal(new Row(ribbon, id + "-0"), false);
                break;

            case SectionType.Divider:
                break;

            default:
                throw new ArgumentException("Invalid SectionType");
            }
        }
        private void SeedSectionTypes()
        {
            Console.WriteLine("SectionTypes");

            SectionType sectionTypeArticles = new SectionType
            {
                Id    = dataContainer.NextSectionTypeId(),
                Name  = "Articles",
                Title = "Articles"
            };

            dataContainer.SectionTypes.Add(sectionTypeArticles);

            SectionType sectionTypeForum = new SectionType
            {
                Id    = dataContainer.NextSectionTypeId(),
                Name  = "Forum",
                Title = "Forum"
            };

            dataContainer.SectionTypes.Add(sectionTypeForum);

            SectionType sectionTypeBlog = new SectionType
            {
                Id    = dataContainer.NextSectionTypeId(),
                Name  = "Blog",
                Title = "Blog"
            };

            dataContainer.SectionTypes.Add(sectionTypeBlog);
        }
Example #35
0
 public static void UnlockSection(string username, string targetUsername, SectionType type, int? targetId, DateTime unlockedUntil)
 {
     using (SqlConnection conn = Config.DB.Open())
     {
         SqlHelper.ExecuteNonQuery(conn, "UnlockSection",
                                                 username, targetUsername, type, targetId, unlockedUntil);
     }
 }
Example #36
0
        /// <summary>
        /// Creates a new section as part of an intermediate.
        /// </summary>
        /// <param name="id">Identifier for section.</param>
        /// <param name="type">Type of section.</param>
        /// <param name="codepage">Codepage for resulting database.</param>
        public Section(string id, SectionType type, int codepage)
        {
            this.id = id;
            this.type = type;
            this.codepage = codepage;

            this.tables = new TableCollection();
        }
Example #37
0
 /// <summary>
 /// Create an analytical bar.
 /// </summary>
 /// <param name="start">The start node.</param>
 /// <param name="end">The end node.</param>
 /// <param name="diameter">The diameter.</param>
 /// <param name="sectionType">The section type.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="endRelease">The end release.</param>
 public AnalyticalBar(AnalyticalNode start, AnalyticalNode end, double diameter, SectionType sectionType, double thickness, string endRelease)
 {
     Start = start;
     End = end;
     Diameter = diameter;
     SectionType = sectionType;
     SectionThickness = thickness;
     EndRelease = endRelease;
 }
Example #38
0
        public static bool IsSectionUnlocked(string username, string targetUsername, SectionType type, int? targetId)
        {
            using (SqlConnection conn = Config.DB.Open())
            {
                object result = SqlHelper.ExecuteScalar(conn, "IsSectionUnlocked",
                                                        username, targetUsername, type, targetId);

                return Convert.ToBoolean(result);
            }
        }
Example #39
0
 public Symbol(SymbolType symt, string name, uint val)
 {
     this.type = symt;
     this.name = name;
     this.val = val;
     this.sectType = SectionType.Null;
     this.exported = false;
     this.index = 0;
     this.strindex = 0;
 }
        /// <summary>
        /// An utility method to get the number of rows and columns of the section which is exporting.
        /// </summary>
        /// <param name="doc">Revit document.</param>
        /// <param name="psView">the exporting panel schedule view</param>
        /// <param name="sectionType">the exporting section of the panel schedule.</param>
        /// <param name="nRows">the number of rows.</param>
        /// <param name="nCols">the number of columns.</param>
        protected void getNumberOfRowsAndColumns(Autodesk.Revit.DB.Document doc, PanelScheduleView psView, SectionType sectionType, ref int nRows, ref int nCols)
        {
            Transaction openSectionData = new Transaction(doc, "openSectionData");
            openSectionData.Start();

            TableSectionData sectionData = psView.GetSectionData(sectionType);
            nRows = sectionData.NumberOfRows;
            nCols = sectionData.NumberOfColumns;

            openSectionData.RollBack();
        }
        public Section CreateSection(SectionType type)
        {
            #region Contract
            Contract.Requires<InvalidEnumArgumentException>(Enum.IsDefined(typeof(SectionType), type));
            Contract.Ensures(Contract.Result<Section>() != null);
            #endregion

            // THROWS: NotSupportedException
            var identifier = GetDefaultSectionIdentifier(type);
            // THROWS: NotSupportedException
            return CreateSection(type, identifier);
        }
Example #42
0
        /// <summary>
        /// Creates a new section as part of an intermediate.
        /// </summary>
        /// <param name="intermediate">Parent intermediate.</param>
        /// <param name="id">Identifier for section.</param>
        /// <param name="type">Type of section.</param>
        /// <param name="codepage">Codepage for resulting database.</param>
        public Section(Intermediate intermediate, string id, SectionType type, int codepage)
        {
            this.intermediate = intermediate;
            this.id = id;
            this.type = type;
            this.codepage = codepage;

            this.tables = new TableCollection();
            this.references = new ReferenceCollection();
            this.ignoreModularizations = new IgnoreModularizationCollection();
            this.complexReferences = new ComplexReferenceCollection();
            this.featureBacklinks = new FeatureBacklinkCollection();
        }
Example #43
0
        public void ReadFromStream(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);
            Magic = br.ReadInt32();
            if (Magic != MagicNumber)
                throw new Exception("Неверная сигнатура файла: " + Magic);

            Type = (SectionType)br.ReadInt32();
            Version = br.ReadBigInt32();
            Unknown2 = br.ReadBigInt32();
            SectionLength = br.ReadBigInt32();
            Junk = stream.EnsureRead(28);
        }
Example #44
0
        public WritableSection(SectionType type, GR2Writer writer)
        {
            Type = type;
            MainStream = new MemoryStream();
            MainWriter = new BinaryWriter(MainStream);

            DataStream = new MemoryStream();
            DataWriter = new BinaryWriter(DataStream);

            Writer = MainWriter;
            Header = InitHeader();
            GR2 = writer;
        }
Example #45
0
        private static bool TryReadSectionType(BinaryReader br, int offset, SeDbResEntry entry, out SectionType type)
        {
            br.BaseStream.SetPosition(entry.Offset + offset);

            int magic = br.ReadInt32();
            if (magic != SectionHeader.MagicNumber)
            {
                type = 0;
                return false;
            }

            type = (SectionType)br.ReadInt32();
            return true;
        }
Example #46
0
 public AudioMixerWindow()
 {
     SectionType[] typeArray1 = new SectionType[4];
     typeArray1[1] = SectionType.SnapshotList;
     typeArray1[2] = SectionType.GroupTree;
     typeArray1[3] = SectionType.ViewList;
     this.m_SectionOrder = typeArray1;
     this.m_LayoutMode = LayoutMode.Vertical;
     this.m_ShowReferencedBuses = true;
     this.m_SectionsScrollPosition = Vector2.zero;
     this.m_RepaintCounter = 2;
     this.m_GroupsRenderedAboveSections = true;
     this.m_Ticker = new TickTimerHelper(0.05);
 }
Example #47
0
        public ActionResult Create(SectionType sectionType)
        {
            // check to make sure the id doesn't already exist

            if (ModelState.IsValid)
            {
                _textTypeRepository.EnsurePersistent(sectionType);

                Message = "TextType Created Successfully";

                return RedirectToAction("Index");
            }

            var viewModel = SectionTypeViewModel.Create(Repository);
            viewModel.SectionType = sectionType;

            return View(viewModel);
        }
 public ActionResult GetSection(SectionType? type)
 {
     switch(type){
         case SectionType.TopQuote:
             return PartialView(_rep.GetSection(1));
         case SectionType.BottomQuote:
             return PartialView(_rep.GetSection(2));
         case SectionType.Phone:
             return PartialView(_rep.GetSection(3));
         case SectionType.Counter:
             return PartialView(_rep.GetSection(4));
         case SectionType.FirstSection:
             return PartialView(_rep.GetSection(5));
         case SectionType.SecondSection:
             return PartialView(_rep.GetSection(5));
         default:
             return Content("");
     }
 }
Example #49
0
        public MetalSection(SectionType type)
            : base(type)
        {
            m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("totem_sprite_1"), m_transform);
            m_sprite.Origin = TotemSection.spriteOrigin;

            bool left = type == SectionType.Left || type == SectionType.Bilateral;
            bool right = type == SectionType.Right || type == SectionType.Bilateral;
            if (left)
            {
                m_metalSpriteLeft = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("totem_sprite_metal_left"), new Transform(m_transform, true));
                m_metalSpriteLeft.Transform.PosX = -3;
                m_metalSpriteLeft.Origin = TotemSection.spriteOrigin;
            }
            if (right)
            {
                m_metalSpriteRight = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("totem_sprite_metal_right"), new Transform(m_transform, true));
                m_metalSpriteRight.Transform.PosX = 3;
                m_metalSpriteRight.Origin = TotemSection.spriteOrigin;
            }
        }
        public virtual Section CreateSection(SectionType type, string identifier)
        {
            #region Contract
            Contract.Requires<InvalidEnumArgumentException>(Enum.IsDefined(typeof(SectionType), type));
            Contract.Requires<ArgumentNullException>(identifier != null);
            Contract.Requires<ArgumentException>(IsValidIdentifier(identifier));
            Contract.Ensures(Contract.Result<Section>() != null);
            #endregion

            var section = new Section(identifier);

            switch (type)
            {
                case SectionType.None:
                    break;
                case SectionType.Program:
                    section.Allocate = true;
                    section.Writable = false;
                    section.Executable = true;
                    section.NoBits = false;
                    break;
                case SectionType.Data:
                    section.Allocate = true;
                    section.Writable = true;
                    section.Executable = false;
                    section.NoBits = false;
                    break;
                case SectionType.Bss:
                    section.Allocate = true;
                    section.Writable = true;
                    section.Executable = false;
                    section.NoBits = true;
                    break;
                default:
                    throw new NotSupportedException("The specified SectionType is not supported.");
            }

            return section;
        }
Example #51
0
        public ActionResult Edit(string id, SectionType sectionType)
        {
            var textTypeToEdit = _textTypeRepository.GetNullableById(id);

            if (textTypeToEdit == null) return RedirectToAction("Index");

            AutoMapper.Mapper.Map(sectionType, textTypeToEdit);

            if (ModelState.IsValid)
            {
                _textTypeRepository.EnsurePersistent(textTypeToEdit);

                Message = "TextType Edited Successfully";

                return RedirectToAction("Index");
            }

            var viewModel = SectionTypeViewModel.Create(Repository);
            viewModel.SectionType = sectionType;

            return View(viewModel);
        }
Example #52
0
 private bool isChangeModeLine(string line)
 {
     switch (line)
     {
         case "CONFIG_BEGIN":
             _currentLineNumber = 0;
             _parserMode = SectionType.Config;
             return true;
         case "DATA_BEGIN":
             _currentLineNumber = 0;
             _parserMode = SectionType.Data;
             return true;
         case "PREFABS_BEGIN":
             _currentLineNumber = 0;
             _parserMode = SectionType.Prefabs;
             return true;
         case "END":
             _currentLineNumber = 0;
             _parserMode = SectionType.None;
             return true;
     }
     return false;
 }
Example #53
0
        public void Deserialize(Stream input, Endian endianness)
        {
            this.DataSize = input.ReadValueU32(endianness);

            var type = input.ReadValueU8();
            if (ValidSectionTypes.ContainsKey(type) == false)
            {
                throw new FormatException("unknown section type");
            }
            this.Type = (SectionType)type;

            this.Unknown05 = input.ReadValueU8();
            this.Unknown06 = input.ReadValueU16(endianness);
            this.Flags = input.ReadValueU32(endianness);
            this.Id = input.ReadValueU32(endianness);
            this.Unknown10 = input.ReadValueU32(endianness);
        }
Example #54
0
        public virtual Section Section(SectionType type)
        {
            if(!_sections.ContainsKey(type))
                _sections.Add(type, new Section(type));

            return _sections[type];
        }
Example #55
0
        private bool WriteSection(SectionType type, SectionBase section, BinaryWriter bw)
        {
            //Write section type
            bw.Write((byte)type);

            //Reserve space for section length
            long sectLenPos = bw.BaseStream.Position;
            bw.Write(int.MinValue);

            //Write the section
            bool opCompleted = section.WriteSection(bw);

            //Check if something was wrong
            int sectionSize = (int) (bw.BaseStream.Position - sectLenPos - sizeof (int));
            if (!opCompleted || sectionSize == 0)
            {
                return false;
            }

            //Update section size
            bw.BaseStream.Seek(sectLenPos, SeekOrigin.Begin);
            bw.Write(sectionSize);
            bw.BaseStream.Seek(0, SeekOrigin.End);

            return true;
        }
Example #56
0
        private ReadLineResult ParseLine(string line, ref SectionType secType, out string key, out IValue value)
        {
            key = string.Empty;
            value = null;
            // Comment
            int commentStart = line.IndexOf("#");
            if (commentStart == 0)
            {
                secType = SectionType.Comment;
                return ReadLineResult.OK;
            }
            // Title
            int leftBracketPos = line.IndexOf("[");
            if (leftBracketPos == 0)
            {
                int rightBracketPos = line.IndexOf("]");
                if (rightBracketPos > 0)
                {
                    string content = line.Substring(leftBracketPos + 1, rightBracketPos - leftBracketPos - 1);
                    content = content.Trim();
                    if (IsValidKey(content))
                    {
                        secType = SectionType.Title;
                        key = content;
                        return ReadLineResult.OK;
                    }
                }
                return ReadLineResult.Error;
            }
            // Assignment
            int assignPos = line.IndexOf("=");
            if (assignPos > 0)
            {
                string assignBefore = line.Substring(0, assignPos).Trim();
                if (IsValidKey(assignBefore))
                {
                    key = assignBefore;
                    string assignAfter = line.Substring(assignPos + 1).Trim();
                    if (assignAfter.StartsWith("[") && assignAfter.EndsWith("]"))
                    {
                        this.ParseArray(assignAfter, out value);
                        return ReadLineResult.Error;
                    }
                    else if (assignAfter.StartsWith("{") && assignAfter.EndsWith("}"))
                    {

                        return ReadLineResult.Error;
                    }
                    else
                    {
                        if (assignAfter.StartsWith("<<"))
                        {
                            string delimiter = assignAfter.Substring(2).Trim();
                            StringBuilder sb = new StringBuilder();
                            string oneLine = streamReader.ReadLine();
                            while (oneLine != null)
                            {
                                if (oneLine != delimiter)
                                {
                                    sb.Append(oneLine).Append('\n');
                                    oneLine = streamReader.ReadLine();
                                }
                                else
                                {
                                    break;
                                }
                            }
                            value = new StringValue(sb.ToString());
                            secType = SectionType.KeyWithStringValue;
                            return ReadLineResult.OK;
                        }
                        else
                        {
                            if (assignAfter.StartsWith("\"") && assignAfter.EndsWith("\""))
                            {
                                assignAfter = assignAfter.Substring(1, assignAfter.Length - 2);
                            }
                            value = new StringValue(assignAfter);
                            secType = SectionType.KeyWithStringValue;
                            return ReadLineResult.OK;
                        }
                    }
                }
                return ReadLineResult.Error;
            }
            return ReadLineResult.Error;
        }
Example #57
0
 /// <summary>
 /// Reads the specified writer.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public void Read(BinaryReader reader)
 {
     Address = reader.ReadUInt16();
     Name = reader.ReadUInt32();
     Type = (SectionType)reader.ReadUInt16();
     Flags = (SectionAttribute)reader.ReadUInt16();
     Address = reader.ReadUInt32();
     Offset = reader.ReadUInt32();
     Size = reader.ReadUInt32();
     Link = reader.ReadUInt32();
     Info = reader.ReadUInt32();
     AddressAlignment = reader.ReadUInt32();
     EntrySize = reader.ReadUInt32();
 }
Example #58
0
 public Section(SectionType t)
 {
     type = t;
 }
        // depthLevel нужен для отладки, если мы вдруг захочется вывести структуру файла
        private void ProcessRenderwareSection(int size, int depthLevel, SectionType parentType)
        {
            int sectionEnd = (int)input.BaseStream.Position + size;

             while (input.BaseStream.Position < sectionEnd)
             {
            SectionHeader header = new SectionHeader();
            header.Read(input);

            switch(header.SectionType)
            {
               case SectionType.Extension:
               case SectionType.Texture:
               case SectionType.Material:
               case SectionType.MaterialList:
               case SectionType.FrameList:
               case SectionType.Geometry:
               case SectionType.Clump:
               case SectionType.Atomic:
               case SectionType.GeometryList:
                  ProcessRenderwareSection(header.SectionSize, depthLevel + 1, header.SectionType);
                  break;

               case SectionType.MaterialSplit:
                  ParseMaterialSplit(header.SectionSize);
                  break;

               case SectionType.Frame:
                  ParseFrame(header.SectionSize);
                  break;

               case SectionType.Data:
                  ParseDataSection(header.SectionSize, parentType, header.Version);
                  break;

               case SectionType.String:
                  ParseStringSection(header.SectionSize, parentType);
                  break;

               default:
                  input.BaseStream.Seek(header.SectionSize, SeekOrigin.Current);
                  break;
            }
             }
        }
Example #60
0
        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "00417926", RsidParagraphAddition = "002C2DE6", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0" };
            Justification justification1 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            RunFonts runFonts1 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold1 = new Bold();
            FontSize fontSize1 = new FontSize() { Val = "30" };

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(bold1);
            paragraphMarkRunProperties1.Append(fontSize1);

            paragraphProperties1.Append(spacingBetweenLines1);
            paragraphProperties1.Append(justification1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);

            Run run1 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties1 = new RunProperties();
            RunFonts runFonts2 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold2 = new Bold();
            FontSize fontSize2 = new FontSize() { Val = "30" };

            runProperties1.Append(runFonts2);
            runProperties1.Append(bold2);
            runProperties1.Append(fontSize2);
            Text text1 = new Text();
            text1.Text = "Hard To Find Books";

            run1.Append(runProperties1);
            run1.Append(text1);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);

            Paragraph paragraph2 = new Paragraph() { RsidParagraphMarkRevision = "00417926", RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines2 = new SpacingBetweenLines() { After = "0" };
            Justification justification2 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties2 = new ParagraphMarkRunProperties();
            RunFonts runFonts3 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold3 = new Bold();
            FontSize fontSize3 = new FontSize() { Val = "30" };

            paragraphMarkRunProperties2.Append(runFonts3);
            paragraphMarkRunProperties2.Append(bold3);
            paragraphMarkRunProperties2.Append(fontSize3);

            paragraphProperties2.Append(spacingBetweenLines2);
            paragraphProperties2.Append(justification2);
            paragraphProperties2.Append(paragraphMarkRunProperties2);

            Run run2 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties2 = new RunProperties();
            RunFonts runFonts4 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold4 = new Bold();
            FontSize fontSize4 = new FontSize() { Val = "30" };

            runProperties2.Append(runFonts4);
            runProperties2.Append(bold4);
            runProperties2.Append(fontSize4);
            Text text2 = new Text();
            text2.Text = "Internet NZ Ltd.";

            run2.Append(runProperties2);
            run2.Append(text2);

            paragraph2.Append(paragraphProperties2);
            paragraph2.Append(run2);

            Paragraph paragraph3 = new Paragraph() { RsidParagraphMarkRevision = "00417926", RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties3 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines3 = new SpacingBetweenLines() { After = "0" };
            Justification justification3 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties3 = new ParagraphMarkRunProperties();
            RunFonts runFonts5 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize5 = new FontSize() { Val = "16" };

            paragraphMarkRunProperties3.Append(runFonts5);
            paragraphMarkRunProperties3.Append(fontSize5);

            paragraphProperties3.Append(spacingBetweenLines3);
            paragraphProperties3.Append(justification3);
            paragraphProperties3.Append(paragraphMarkRunProperties3);

            Run run3 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties3 = new RunProperties();
            RunFonts runFonts6 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize6 = new FontSize() { Val = "16" };

            runProperties3.Append(runFonts6);
            runProperties3.Append(fontSize6);
            Text text3 = new Text();
            text3.Text = "PO Box 5645 Moray Pl, Dunedin 9058, New Zealand";

            run3.Append(runProperties3);
            run3.Append(text3);

            paragraph3.Append(paragraphProperties3);
            paragraph3.Append(run3);

            Paragraph paragraph4 = new Paragraph() { RsidParagraphMarkRevision = "00417926", RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties4 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines4 = new SpacingBetweenLines() { After = "0" };
            Justification justification4 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties4 = new ParagraphMarkRunProperties();
            RunFonts runFonts7 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize7 = new FontSize() { Val = "16" };

            paragraphMarkRunProperties4.Append(runFonts7);
            paragraphMarkRunProperties4.Append(fontSize7);

            paragraphProperties4.Append(spacingBetweenLines4);
            paragraphProperties4.Append(justification4);
            paragraphProperties4.Append(paragraphMarkRunProperties4);

            Run run4 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties4 = new RunProperties();
            RunFonts runFonts8 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize8 = new FontSize() { Val = "16" };

            runProperties4.Append(runFonts8);
            runProperties4.Append(fontSize8);
            Text text4 = new Text();
            text4.Text = "Phone: +64 3 4745983, Email: [email protected]";

            run4.Append(runProperties4);
            run4.Append(text4);
            BookmarkStart bookmarkStart1 = new BookmarkStart() { Name = "_GoBack", Id = "0" };
            BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "0" };

            paragraph4.Append(paragraphProperties4);
            paragraph4.Append(run4);
            paragraph4.Append(bookmarkStart1);
            paragraph4.Append(bookmarkEnd1);

            Paragraph paragraph5 = new Paragraph() { RsidParagraphMarkRevision = "00417926", RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties5 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines5 = new SpacingBetweenLines() { After = "0" };
            Justification justification5 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties5 = new ParagraphMarkRunProperties();
            RunFonts runFonts9 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize9 = new FontSize() { Val = "16" };

            paragraphMarkRunProperties5.Append(runFonts9);
            paragraphMarkRunProperties5.Append(fontSize9);

            paragraphProperties5.Append(spacingBetweenLines5);
            paragraphProperties5.Append(justification5);
            paragraphProperties5.Append(paragraphMarkRunProperties5);

            Run run5 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties5 = new RunProperties();
            RunFonts runFonts10 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize10 = new FontSize() { Val = "16" };

            runProperties5.Append(runFonts10);
            runProperties5.Append(fontSize10);
            Text text5 = new Text();
            text5.Text = "GST: 70-526-627 Website: www.hardtofind.co.nz";

            run5.Append(runProperties5);
            run5.Append(text5);

            paragraph5.Append(paragraphProperties5);
            paragraph5.Append(run5);

            Paragraph paragraph6 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties6 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines6 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties6 = new ParagraphMarkRunProperties();
            RunFonts runFonts11 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties6.Append(runFonts11);

            paragraphProperties6.Append(spacingBetweenLines6);
            paragraphProperties6.Append(paragraphMarkRunProperties6);

            paragraph6.Append(paragraphProperties6);

            Paragraph paragraph7 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties7 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines7 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties7 = new ParagraphMarkRunProperties();
            RunFonts runFonts12 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties7.Append(runFonts12);

            SectionProperties sectionProperties1 = new SectionProperties() { RsidR = "00910498" };
            PageSize pageSize1 = new PageSize() { Width = (UInt32Value)11906U, Height = (UInt32Value)16838U };
            PageMargin pageMargin1 = new PageMargin() { Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)708U, Footer = (UInt32Value)708U, Gutter = (UInt32Value)0U };
            Columns columns1 = new Columns() { Space = "708" };
            DocGrid docGrid1 = new DocGrid() { LinePitch = 360 };

            sectionProperties1.Append(pageSize1);
            sectionProperties1.Append(pageMargin1);
            sectionProperties1.Append(columns1);
            sectionProperties1.Append(docGrid1);

            paragraphProperties7.Append(spacingBetweenLines7);
            paragraphProperties7.Append(paragraphMarkRunProperties7);
            paragraphProperties7.Append(sectionProperties1);

            paragraph7.Append(paragraphProperties7);

            Paragraph paragraph8 = new Paragraph() { RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00417926" };

            ParagraphProperties paragraphProperties8 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines8 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties8 = new ParagraphMarkRunProperties();
            RunFonts runFonts13 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize11 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties8.Append(runFonts13);
            paragraphMarkRunProperties8.Append(fontSize11);

            paragraphProperties8.Append(spacingBetweenLines8);
            paragraphProperties8.Append(paragraphMarkRunProperties8);

            Run run6 = new Run() { RsidRunProperties = "00417926" };

            RunProperties runProperties6 = new RunProperties();
            RunFonts runFonts14 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize12 = new FontSize() { Val = "24" };

            runProperties6.Append(runFonts14);
            runProperties6.Append(fontSize12);
            LastRenderedPageBreak lastRenderedPageBreak1 = new LastRenderedPageBreak();
            Text text6 = new Text();
            text6.Text = "Invoice:";

            run6.Append(runProperties6);
            run6.Append(lastRenderedPageBreak1);
            run6.Append(text6);

            paragraph8.Append(paragraphProperties8);
            paragraph8.Append(run6);

            Paragraph paragraph9 = new Paragraph() { RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties9 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines9 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties9 = new ParagraphMarkRunProperties();
            RunFonts runFonts15 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize13 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties9.Append(runFonts15);
            paragraphMarkRunProperties9.Append(fontSize13);

            paragraphProperties9.Append(spacingBetweenLines9);
            paragraphProperties9.Append(paragraphMarkRunProperties9);

            Run run7 = new Run();

            RunProperties runProperties7 = new RunProperties();
            RunFonts runFonts16 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize14 = new FontSize() { Val = "24" };

            runProperties7.Append(runFonts16);
            runProperties7.Append(fontSize14);
            TabChar tabChar1 = new TabChar();
            Text text7 = new Text();

            //TODO add in customer name
            if(customer != null)
                text7.Text = customer.firstName + " " + customer.lastName;
            else
                text7.Text = order.firstName + " " + order.lastName;

            run7.Append(runProperties7);
            run7.Append(tabChar1);
            run7.Append(text7);

            paragraph9.Append(paragraphProperties9);
            paragraph9.Append(run7);

            Paragraph paragraphInstitute = new Paragraph() { RsidParagraphAddition = "00417926", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphInstituteProperties = new ParagraphProperties();
            SpacingBetweenLines institudeSpacingBetweenLines = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphInstituteMarkRunProperties = new ParagraphMarkRunProperties();
            RunFonts paragraphRunFonts = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize paragraphFontSize = new FontSize() { Val = "24" };

            paragraphInstituteMarkRunProperties.Append(paragraphRunFonts);
            paragraphInstituteMarkRunProperties.Append(paragraphFontSize);

            paragraphInstituteProperties.Append(institudeSpacingBetweenLines);
            paragraphInstituteProperties.Append(paragraphInstituteMarkRunProperties);

            Run instituteRun = new Run();

            RunProperties instituteRunProperties = new RunProperties();
            RunFonts instituteRunFonts = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize instituteFontSize = new FontSize() { Val = "24" };

            instituteRunProperties.Append(instituteRunFonts);
            instituteRunProperties.Append(instituteFontSize);
            TabChar instituteTabChar = new TabChar();
            Text instituteText = new Text();

            //TODO add in institute
            instituteText.Text = customer.institution;

            instituteRun.Append(instituteRunProperties);
            instituteRun.Append(instituteTabChar);
            instituteRun.Append(instituteText);

            paragraphInstitute.Append(paragraphInstituteProperties);
            paragraphInstitute.Append(instituteRun);

            Paragraph paragraph10 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties10 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines10 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties10 = new ParagraphMarkRunProperties();
            RunFonts runFonts17 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize15 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties10.Append(runFonts17);
            paragraphMarkRunProperties10.Append(fontSize15);

            paragraphProperties10.Append(spacingBetweenLines10);
            paragraphProperties10.Append(paragraphMarkRunProperties10);

            Run run8 = new Run();

            RunProperties runProperties8 = new RunProperties();
            RunFonts runFonts18 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize16 = new FontSize() { Val = "24" };

            runProperties8.Append(runFonts18);
            runProperties8.Append(fontSize16);
            TabChar tabChar2 = new TabChar();
            Text text8 = new Text();

            //TODO add in address1
            //text8.Text = "62 Seaview Avenue";
            if(customer != null)
                text8.Text = customer.address1;
            else
                text8.Text = "";

            run8.Append(runProperties8);
            run8.Append(tabChar2);
            run8.Append(text8);

            paragraph10.Append(paragraphProperties10);
            paragraph10.Append(run8);

            Paragraph paragraph11 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties11 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines11 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties11 = new ParagraphMarkRunProperties();
            RunFonts runFonts19 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize17 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties11.Append(runFonts19);
            paragraphMarkRunProperties11.Append(fontSize17);

            paragraphProperties11.Append(spacingBetweenLines11);
            paragraphProperties11.Append(paragraphMarkRunProperties11);

            Run run9 = new Run();

            RunProperties runProperties9 = new RunProperties();
            RunFonts runFonts20 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize18 = new FontSize() { Val = "24" };

            runProperties9.Append(runFonts20);
            runProperties9.Append(fontSize18);
            TabChar tabChar3 = new TabChar();
            Text text9 = new Text();

            //TODO add in address2
            //text9.Text = "Northcote";
            if(customer != null)
                text9.Text = customer.address2;
            else
                text9.Text = "";

            run9.Append(runProperties9);
            run9.Append(tabChar3);
            run9.Append(text9);

            paragraph11.Append(paragraphProperties11);
            paragraph11.Append(run9);

            Paragraph paragraph12 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties12 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines12 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties12 = new ParagraphMarkRunProperties();
            RunFonts runFonts21 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize19 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties12.Append(runFonts21);
            paragraphMarkRunProperties12.Append(fontSize19);

            paragraphProperties12.Append(spacingBetweenLines12);
            paragraphProperties12.Append(paragraphMarkRunProperties12);

            Run run10 = new Run();

            RunProperties runProperties10 = new RunProperties();
            RunFonts runFonts22 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize20 = new FontSize() { Val = "24" };

            runProperties10.Append(runFonts22);
            runProperties10.Append(fontSize20);
            TabChar tabChar4 = new TabChar();
            Text text10 = new Text();

            //TODO add in address3
            //text10.Text = "Auckland";
            if(customer != null)
                text10.Text = customer.address3;
            else
                text10.Text = "";

            run10.Append(runProperties10);
            run10.Append(tabChar4);
            run10.Append(text10);

            paragraph12.Append(paragraphProperties12);
            paragraph12.Append(run10);

            Paragraph paragraph13 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties13 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines13 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties13 = new ParagraphMarkRunProperties();
            RunFonts runFonts23 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize21 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties13.Append(runFonts23);
            paragraphMarkRunProperties13.Append(fontSize21);

            paragraphProperties13.Append(spacingBetweenLines13);
            paragraphProperties13.Append(paragraphMarkRunProperties13);

            Run run11 = new Run();

            RunProperties runProperties11 = new RunProperties();
            RunFonts runFonts24 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize22 = new FontSize() { Val = "24" };

            runProperties11.Append(runFonts24);
            runProperties11.Append(fontSize22);
            TabChar tabChar5 = new TabChar();
            Text text11 = new Text();

            //TODO add in postcode
            //text11.Text = "0627";
            if(customer != null)
                text11.Text = customer.postCode;
            else
                text11.Text = "";

            run11.Append(runProperties11);
            run11.Append(tabChar5);
            run11.Append(text11);

            paragraph13.Append(paragraphProperties13);
            paragraph13.Append(run11);

            Paragraph paragraph14 = new Paragraph() { RsidParagraphAddition = "00910498", RsidParagraphProperties = "00417926", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties14 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines14 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties14 = new ParagraphMarkRunProperties();
            RunFonts runFonts25 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize23 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties14.Append(runFonts25);
            paragraphMarkRunProperties14.Append(fontSize23);

            paragraphProperties14.Append(spacingBetweenLines14);
            paragraphProperties14.Append(paragraphMarkRunProperties14);

            Run run12 = new Run();

            RunProperties runProperties12 = new RunProperties();
            RunFonts runFonts26 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize24 = new FontSize() { Val = "24" };

            runProperties12.Append(runFonts26);
            runProperties12.Append(fontSize24);
            TabChar tabChar6 = new TabChar();
            Text text12 = new Text();

            //TODO add in country
            if(customer != null)
                text12.Text = customer.country;
            else
                text12.Text = "";

            run12.Append(runProperties12);
            run12.Append(tabChar6);
            run12.Append(text12);

            paragraph14.Append(paragraphProperties14);
            paragraph14.Append(run12);

            Paragraph paragraph15 = new Paragraph() { RsidParagraphAddition = "003F6835", RsidParagraphProperties = "003F6835", RsidRunAdditionDefault = "00910498" };

            ParagraphProperties paragraphProperties15 = new ParagraphProperties();

            Tabs tabs1 = new Tabs();
            TabStop tabStop1 = new TabStop() { Val = TabStopValues.Left, Position = 2835 };

            tabs1.Append(tabStop1);
            SpacingBetweenLines spacingBetweenLines15 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties15 = new ParagraphMarkRunProperties();
            RunFonts runFonts27 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize25 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties15.Append(runFonts27);
            paragraphMarkRunProperties15.Append(fontSize25);

            paragraphProperties15.Append(tabs1);
            paragraphProperties15.Append(spacingBetweenLines15);
            paragraphProperties15.Append(paragraphMarkRunProperties15);

            Run run13 = new Run();

            RunProperties runProperties13 = new RunProperties();
            RunFonts runFonts28 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize26 = new FontSize() { Val = "24" };

            runProperties13.Append(runFonts28);
            runProperties13.Append(fontSize26);
            Break break1 = new Break() { Type = BreakValues.Column };

            run13.Append(runProperties13);
            run13.Append(break1);

            paragraph15.Append(paragraphProperties15);
            paragraph15.Append(run13);

            Table table1 = new Table();

            TableProperties tableProperties1 = new TableProperties();
            TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" };
            TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto };

            TableBorders tableBorders1 = new TableBorders();
            TopBorder topBorder1 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideHorizontalBorder insideHorizontalBorder1 = new InsideHorizontalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideVerticalBorder insideVerticalBorder1 = new InsideVerticalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            tableBorders1.Append(topBorder1);
            tableBorders1.Append(leftBorder1);
            tableBorders1.Append(bottomBorder1);
            tableBorders1.Append(rightBorder1);
            tableBorders1.Append(insideHorizontalBorder1);
            tableBorders1.Append(insideVerticalBorder1);
            TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true };

            tableProperties1.Append(tableStyle1);
            tableProperties1.Append(tableWidth1);
            tableProperties1.Append(tableBorders1);
            tableProperties1.Append(tableLook1);

            TableGrid tableGrid1 = new TableGrid();
            GridColumn gridColumn1 = new GridColumn() { Width = "3006" };
            GridColumn gridColumn2 = new GridColumn() { Width = "255" };
            GridColumn gridColumn3 = new GridColumn() { Width = "1099" };

            tableGrid1.Append(gridColumn1);
            tableGrid1.Append(gridColumn2);
            tableGrid1.Append(gridColumn3);

            TableRow tableRow1 = new TableRow() { RsidTableRowMarkRevision = "00613B48", RsidTableRowAddition = "00613B48", RsidTableRowProperties = "00613B48" };

            TableCell tableCell1 = new TableCell();

            TableCellProperties tableCellProperties1 = new TableCellProperties();
            TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = "3006", Type = TableWidthUnitValues.Dxa };

            tableCellProperties1.Append(tableCellWidth1);

            Paragraph paragraph16 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00AB530E", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties16 = new ParagraphProperties();

            ParagraphMarkRunProperties paragraphMarkRunProperties16 = new ParagraphMarkRunProperties();
            RunFonts runFonts29 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize27 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties16.Append(runFonts29);
            paragraphMarkRunProperties16.Append(fontSize27);

            paragraphProperties16.Append(paragraphMarkRunProperties16);

            Run run14 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties14 = new RunProperties();
            RunFonts runFonts30 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize28 = new FontSize() { Val = "24" };

            runProperties14.Append(runFonts30);
            runProperties14.Append(fontSize28);
            Text text13 = new Text();
            text13.Text = "Date:";

            run14.Append(runProperties14);
            run14.Append(text13);

            paragraph16.Append(paragraphProperties16);
            paragraph16.Append(run14);

            tableCell1.Append(tableCellProperties1);
            tableCell1.Append(paragraph16);

            TableCell tableCell2 = new TableCell();

            TableCellProperties tableCellProperties2 = new TableCellProperties();
            TableCellWidth tableCellWidth2 = new TableCellWidth() { Width = "1354", Type = TableWidthUnitValues.Dxa };
            GridSpan gridSpan1 = new GridSpan() { Val = 2 };

            tableCellProperties2.Append(tableCellWidth2);
            tableCellProperties2.Append(gridSpan1);

            Paragraph paragraph17 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00613B48", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties17 = new ParagraphProperties();
            Justification justification6 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties17 = new ParagraphMarkRunProperties();
            RunFonts runFonts31 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize29 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties17.Append(runFonts31);
            paragraphMarkRunProperties17.Append(fontSize29);

            paragraphProperties17.Append(justification6);
            paragraphProperties17.Append(paragraphMarkRunProperties17);

            Run run15 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties15 = new RunProperties();
            RunFonts runFonts32 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize30 = new FontSize() { Val = "24" };

            runProperties15.Append(runFonts32);
            runProperties15.Append(fontSize30);
            Text text14 = new Text();

            //TODO add invoice date
            //text14.Text = "2/02/2016";
            text14.Text = order.invoiceDate.ToString("d/MM/yyyy"); ;

            run15.Append(runProperties15);
            run15.Append(text14);

            paragraph17.Append(paragraphProperties17);
            paragraph17.Append(run15);

            tableCell2.Append(tableCellProperties2);
            tableCell2.Append(paragraph17);

            tableRow1.Append(tableCell1);
            tableRow1.Append(tableCell2);

            TableRow tableRow2 = new TableRow() { RsidTableRowMarkRevision = "00613B48", RsidTableRowAddition = "00613B48", RsidTableRowProperties = "009B6C59" };

            TableCell tableCell3 = new TableCell();

            TableCellProperties tableCellProperties3 = new TableCellProperties();
            TableCellWidth tableCellWidth3 = new TableCellWidth() { Width = "3261", Type = TableWidthUnitValues.Dxa };
            GridSpan gridSpan2 = new GridSpan() { Val = 2 };

            tableCellProperties3.Append(tableCellWidth3);
            tableCellProperties3.Append(gridSpan2);

            Paragraph paragraph18 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00AB530E", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties18 = new ParagraphProperties();

            ParagraphMarkRunProperties paragraphMarkRunProperties18 = new ParagraphMarkRunProperties();
            RunFonts runFonts33 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize31 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties18.Append(runFonts33);
            paragraphMarkRunProperties18.Append(fontSize31);

            paragraphProperties18.Append(paragraphMarkRunProperties18);

            Run run16 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties16 = new RunProperties();
            RunFonts runFonts34 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize32 = new FontSize() { Val = "24" };

            runProperties16.Append(runFonts34);
            runProperties16.Append(fontSize32);
            Text text15 = new Text();
            text15.Text = "GST Tax Invoice Number:";

            run16.Append(runProperties16);
            run16.Append(text15);

            paragraph18.Append(paragraphProperties18);
            paragraph18.Append(run16);

            tableCell3.Append(tableCellProperties3);
            tableCell3.Append(paragraph18);

            TableCell tableCell4 = new TableCell();

            TableCellProperties tableCellProperties4 = new TableCellProperties();
            TableCellWidth tableCellWidth4 = new TableCellWidth() { Width = "1099", Type = TableWidthUnitValues.Dxa };

            tableCellProperties4.Append(tableCellWidth4);

            Paragraph paragraph19 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00613B48", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties19 = new ParagraphProperties();
            Justification justification7 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties19 = new ParagraphMarkRunProperties();
            RunFonts runFonts35 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize33 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties19.Append(runFonts35);
            paragraphMarkRunProperties19.Append(fontSize33);

            paragraphProperties19.Append(justification7);
            paragraphProperties19.Append(paragraphMarkRunProperties19);

            Run run17 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties17 = new RunProperties();
            RunFonts runFonts36 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize34 = new FontSize() { Val = "24" };

            runProperties17.Append(runFonts36);
            runProperties17.Append(fontSize34);
            Text text16 = new Text();

            //TODO add invoice number/orderID
            //text16.Text = "39248";
            text16.Text = order.orderID.ToString();

            run17.Append(runProperties17);
            run17.Append(text16);

            paragraph19.Append(paragraphProperties19);
            paragraph19.Append(run17);

            tableCell4.Append(tableCellProperties4);
            tableCell4.Append(paragraph19);

            tableRow2.Append(tableCell3);
            tableRow2.Append(tableCell4);

            TableRow tableRow3 = new TableRow() { RsidTableRowMarkRevision = "00613B48", RsidTableRowAddition = "00613B48", RsidTableRowProperties = "00613B48" };

            TableCell tableCell5 = new TableCell();

            TableCellProperties tableCellProperties5 = new TableCellProperties();
            TableCellWidth tableCellWidth5 = new TableCellWidth() { Width = "3006", Type = TableWidthUnitValues.Dxa };

            tableCellProperties5.Append(tableCellWidth5);

            Paragraph paragraph20 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00AB530E", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties20 = new ParagraphProperties();

            ParagraphMarkRunProperties paragraphMarkRunProperties20 = new ParagraphMarkRunProperties();
            RunFonts runFonts37 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize35 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties20.Append(runFonts37);
            paragraphMarkRunProperties20.Append(fontSize35);

            paragraphProperties20.Append(paragraphMarkRunProperties20);

            Run run18 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties18 = new RunProperties();
            RunFonts runFonts38 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize36 = new FontSize() { Val = "24" };

            runProperties18.Append(runFonts38);
            runProperties18.Append(fontSize36);
            Text text17 = new Text();
            text17.Text = "Your Reference:";

            run18.Append(runProperties18);
            run18.Append(text17);

            paragraph20.Append(paragraphProperties20);
            paragraph20.Append(run18);

            tableCell5.Append(tableCellProperties5);
            tableCell5.Append(paragraph20);

            TableCell tableCell6 = new TableCell();

            TableCellProperties tableCellProperties6 = new TableCellProperties();
            TableCellWidth tableCellWidth6 = new TableCellWidth() { Width = "1354", Type = TableWidthUnitValues.Dxa };
            GridSpan gridSpan3 = new GridSpan() { Val = 2 };

            tableCellProperties6.Append(tableCellWidth6);
            tableCellProperties6.Append(gridSpan3);

            Paragraph paragraph21 = new Paragraph() { RsidParagraphMarkRevision = "00613B48", RsidParagraphAddition = "00613B48", RsidParagraphProperties = "00613B48", RsidRunAdditionDefault = "00613B48" };

            ParagraphProperties paragraphProperties21 = new ParagraphProperties();
            Justification justification8 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties21 = new ParagraphMarkRunProperties();
            RunFonts runFonts39 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize37 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties21.Append(runFonts39);
            paragraphMarkRunProperties21.Append(fontSize37);

            paragraphProperties21.Append(justification8);
            paragraphProperties21.Append(paragraphMarkRunProperties21);

            Run run19 = new Run() { RsidRunProperties = "00613B48" };

            RunProperties runProperties19 = new RunProperties();
            RunFonts runFonts40 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize38 = new FontSize() { Val = "24" };

            runProperties19.Append(runFonts40);
            runProperties19.Append(fontSize38);
            Text text18 = new Text();

            //TODO add order reference
            //text18.Text = "Visa";
            text18.Text = order.orderReference;

            run19.Append(runProperties19);
            run19.Append(text18);

            paragraph21.Append(paragraphProperties21);
            paragraph21.Append(run19);

            tableCell6.Append(tableCellProperties6);
            tableCell6.Append(paragraph21);

            tableRow3.Append(tableCell5);
            tableRow3.Append(tableCell6);

            table1.Append(tableProperties1);
            table1.Append(tableGrid1);
            table1.Append(tableRow1);
            table1.Append(tableRow2);
            table1.Append(tableRow3);

            Paragraph paragraph22 = new Paragraph() { RsidParagraphAddition = "00EA7D1E", RsidParagraphProperties = "007F61F5", RsidRunAdditionDefault = "00EA7D1E" };

            ParagraphProperties paragraphProperties22 = new ParagraphProperties();

            Tabs tabs2 = new Tabs();
            TabStop tabStop2 = new TabStop() { Val = TabStopValues.Left, Position = 3119 };

            tabs2.Append(tabStop2);
            SpacingBetweenLines spacingBetweenLines16 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties22 = new ParagraphMarkRunProperties();
            RunFonts runFonts41 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize39 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties22.Append(runFonts41);
            paragraphMarkRunProperties22.Append(fontSize39);

            paragraphProperties22.Append(tabs2);
            paragraphProperties22.Append(spacingBetweenLines16);
            paragraphProperties22.Append(paragraphMarkRunProperties22);

            paragraph22.Append(paragraphProperties22);

            Paragraph paragraph23 = new Paragraph() { RsidParagraphAddition = "00EA7D1E", RsidParagraphProperties = "007F61F5", RsidRunAdditionDefault = "00EA7D1E" };

            ParagraphProperties paragraphProperties23 = new ParagraphProperties();

            Tabs tabs3 = new Tabs();
            TabStop tabStop3 = new TabStop() { Val = TabStopValues.Left, Position = 3119 };

            tabs3.Append(tabStop3);
            SpacingBetweenLines spacingBetweenLines17 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties23 = new ParagraphMarkRunProperties();
            RunFonts runFonts42 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize40 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties23.Append(runFonts42);
            paragraphMarkRunProperties23.Append(fontSize40);

            SectionProperties sectionProperties2 = new SectionProperties() { RsidR = "00EA7D1E", RsidSect = "00015C18" };
            SectionType sectionType1 = new SectionType() { Val = SectionMarkValues.Continuous };
            PageSize pageSize2 = new PageSize() { Width = (UInt32Value)11906U, Height = (UInt32Value)16838U };
            PageMargin pageMargin2 = new PageMargin() { Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)708U, Footer = (UInt32Value)708U, Gutter = (UInt32Value)0U };
            Columns columns2 = new Columns() { Space = "286", ColumnCount = 2 };
            DocGrid docGrid2 = new DocGrid() { LinePitch = 360 };

            sectionProperties2.Append(sectionType1);
            sectionProperties2.Append(pageSize2);
            sectionProperties2.Append(pageMargin2);
            sectionProperties2.Append(columns2);
            sectionProperties2.Append(docGrid2);

            paragraphProperties23.Append(tabs3);
            paragraphProperties23.Append(spacingBetweenLines17);
            paragraphProperties23.Append(paragraphMarkRunProperties23);
            paragraphProperties23.Append(sectionProperties2);

            paragraph23.Append(paragraphProperties23);

            Paragraph paragraph24 = new Paragraph() { RsidParagraphMarkRevision = "00646179", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00646179", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties24 = new ParagraphProperties();

            Tabs tabs4 = new Tabs();
            TabStop tabStop4 = new TabStop() { Val = TabStopValues.Left, Position = 3119 };

            tabs4.Append(tabStop4);
            SpacingBetweenLines spacingBetweenLines18 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties24 = new ParagraphMarkRunProperties();
            RunFonts runFonts43 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize41 = new FontSize() { Val = "24" };

            paragraphMarkRunProperties24.Append(runFonts43);
            paragraphMarkRunProperties24.Append(fontSize41);

            paragraphProperties24.Append(tabs4);
            paragraphProperties24.Append(spacingBetweenLines18);
            paragraphProperties24.Append(paragraphMarkRunProperties24);

            paragraph24.Append(paragraphProperties24);

            Table table2 = new Table();

            TableProperties tableProperties2 = new TableProperties();
            TableStyle tableStyle2 = new TableStyle() { Val = "TableGrid" };
            TableWidth tableWidth2 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto };

            TableBorders tableBorders2 = new TableBorders();
            LeftBorder leftBorder2 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder2 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideVerticalBorder insideVerticalBorder2 = new InsideVerticalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            tableBorders2.Append(leftBorder2);
            tableBorders2.Append(rightBorder2);
            tableBorders2.Append(insideVerticalBorder2);
            TableLook tableLook2 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true };

            tableProperties2.Append(tableStyle2);
            tableProperties2.Append(tableWidth2);
            tableProperties2.Append(tableBorders2);
            tableProperties2.Append(tableLook2);

            TableGrid tableGrid2 = new TableGrid();
            GridColumn gridColumn4 = new GridColumn() { Width = "1418" };
            GridColumn gridColumn5 = new GridColumn() { Width = "2719" };
            GridColumn gridColumn6 = new GridColumn() { Width = "1036" };
            GridColumn gridColumn7 = new GridColumn() { Width = "1364" };
            GridColumn gridColumn8 = new GridColumn() { Width = "1411" };
            GridColumn gridColumn9 = new GridColumn() { Width = "1078" };

            tableGrid2.Append(gridColumn4);
            tableGrid2.Append(gridColumn5);
            tableGrid2.Append(gridColumn6);
            tableGrid2.Append(gridColumn7);
            tableGrid2.Append(gridColumn8);
            tableGrid2.Append(gridColumn9);

            TableRow tableRow4 = new TableRow() { RsidTableRowAddition = "00443ACA", RsidTableRowProperties = "00506382" };

            TableCell tableCell7 = new TableCell();

            TableCellProperties tableCellProperties7 = new TableCellProperties();
            TableCellWidth tableCellWidth7 = new TableCellWidth() { Width = "1418", Type = TableWidthUnitValues.Dxa };

            tableCellProperties7.Append(tableCellWidth7);

            Paragraph paragraph25 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties25 = new ParagraphProperties();

            Tabs tabs5 = new Tabs();
            TabStop tabStop5 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop6 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop7 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop8 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop9 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs5.Append(tabStop5);
            tabs5.Append(tabStop6);
            tabs5.Append(tabStop7);
            tabs5.Append(tabStop8);
            tabs5.Append(tabStop9);
            SpacingBetweenLines spacingBetweenLines19 = new SpacingBetweenLines() { Before = "60", After = "60" };

            ParagraphMarkRunProperties paragraphMarkRunProperties25 = new ParagraphMarkRunProperties();
            RunFonts runFonts44 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties25.Append(runFonts44);

            paragraphProperties25.Append(tabs5);
            paragraphProperties25.Append(spacingBetweenLines19);
            paragraphProperties25.Append(paragraphMarkRunProperties25);
            ProofError proofError1 = new ProofError() { Type = ProofingErrorValues.SpellStart };

            Run run20 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties20 = new RunProperties();
            RunFonts runFonts45 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties20.Append(runFonts45);
            Text text19 = new Text();
            text19.Text = "BookID";

            run20.Append(runProperties20);
            run20.Append(text19);
            ProofError proofError2 = new ProofError() { Type = ProofingErrorValues.SpellEnd };

            paragraph25.Append(paragraphProperties25);
            paragraph25.Append(proofError1);
            paragraph25.Append(run20);
            paragraph25.Append(proofError2);

            tableCell7.Append(tableCellProperties7);
            tableCell7.Append(paragraph25);

            TableCell tableCell8 = new TableCell();

            TableCellProperties tableCellProperties8 = new TableCellProperties();
            TableCellWidth tableCellWidth8 = new TableCellWidth() { Width = "2719", Type = TableWidthUnitValues.Dxa };

            tableCellProperties8.Append(tableCellWidth8);

            Paragraph paragraph26 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties26 = new ParagraphProperties();

            Tabs tabs6 = new Tabs();
            TabStop tabStop10 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop11 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop12 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop13 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop14 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs6.Append(tabStop10);
            tabs6.Append(tabStop11);
            tabs6.Append(tabStop12);
            tabs6.Append(tabStop13);
            tabs6.Append(tabStop14);
            SpacingBetweenLines spacingBetweenLines20 = new SpacingBetweenLines() { Before = "60", After = "60" };

            ParagraphMarkRunProperties paragraphMarkRunProperties26 = new ParagraphMarkRunProperties();
            RunFonts runFonts46 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties26.Append(runFonts46);

            paragraphProperties26.Append(tabs6);
            paragraphProperties26.Append(spacingBetweenLines20);
            paragraphProperties26.Append(paragraphMarkRunProperties26);

            Run run21 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties21 = new RunProperties();
            RunFonts runFonts47 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties21.Append(runFonts47);
            Text text20 = new Text();
            text20.Text = "Description";

            run21.Append(runProperties21);
            run21.Append(text20);

            paragraph26.Append(paragraphProperties26);
            paragraph26.Append(run21);

            tableCell8.Append(tableCellProperties8);
            tableCell8.Append(paragraph26);

            TableCell tableCell9 = new TableCell();

            TableCellProperties tableCellProperties9 = new TableCellProperties();
            TableCellWidth tableCellWidth9 = new TableCellWidth() { Width = "1036", Type = TableWidthUnitValues.Dxa };

            tableCellProperties9.Append(tableCellWidth9);

            Paragraph paragraph27 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties27 = new ParagraphProperties();

            Tabs tabs7 = new Tabs();
            TabStop tabStop15 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop16 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop17 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop18 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop19 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs7.Append(tabStop15);
            tabs7.Append(tabStop16);
            tabs7.Append(tabStop17);
            tabs7.Append(tabStop18);
            tabs7.Append(tabStop19);
            SpacingBetweenLines spacingBetweenLines21 = new SpacingBetweenLines() { Before = "60", After = "60" };
            Justification justification9 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties27 = new ParagraphMarkRunProperties();
            RunFonts runFonts48 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties27.Append(runFonts48);

            paragraphProperties27.Append(tabs7);
            paragraphProperties27.Append(spacingBetweenLines21);
            paragraphProperties27.Append(justification9);
            paragraphProperties27.Append(paragraphMarkRunProperties27);

            Run run22 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties22 = new RunProperties();
            RunFonts runFonts49 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties22.Append(runFonts49);
            Text text21 = new Text();
            text21.Text = "Quantity";

            run22.Append(runProperties22);
            run22.Append(text21);

            paragraph27.Append(paragraphProperties27);
            paragraph27.Append(run22);

            tableCell9.Append(tableCellProperties9);
            tableCell9.Append(paragraph27);

            TableCell tableCell10 = new TableCell();

            TableCellProperties tableCellProperties10 = new TableCellProperties();
            TableCellWidth tableCellWidth10 = new TableCellWidth() { Width = "1364", Type = TableWidthUnitValues.Dxa };

            tableCellProperties10.Append(tableCellWidth10);

            Paragraph paragraph28 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties28 = new ParagraphProperties();

            Tabs tabs8 = new Tabs();
            TabStop tabStop20 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop21 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop22 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop23 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop24 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs8.Append(tabStop20);
            tabs8.Append(tabStop21);
            tabs8.Append(tabStop22);
            tabs8.Append(tabStop23);
            tabs8.Append(tabStop24);
            SpacingBetweenLines spacingBetweenLines22 = new SpacingBetweenLines() { Before = "60", After = "60" };
            Justification justification10 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties28 = new ParagraphMarkRunProperties();
            RunFonts runFonts50 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties28.Append(runFonts50);

            paragraphProperties28.Append(tabs8);
            paragraphProperties28.Append(spacingBetweenLines22);
            paragraphProperties28.Append(justification10);
            paragraphProperties28.Append(paragraphMarkRunProperties28);

            Run run23 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties23 = new RunProperties();
            RunFonts runFonts51 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties23.Append(runFonts51);
            Text text22 = new Text();
            text22.Text = "Price";

            run23.Append(runProperties23);
            run23.Append(text22);

            paragraph28.Append(paragraphProperties28);
            paragraph28.Append(run23);

            tableCell10.Append(tableCellProperties10);
            tableCell10.Append(paragraph28);

            TableCell tableCell11 = new TableCell();

            TableCellProperties tableCellProperties11 = new TableCellProperties();
            TableCellWidth tableCellWidth11 = new TableCellWidth() { Width = "1411", Type = TableWidthUnitValues.Dxa };

            tableCellProperties11.Append(tableCellWidth11);

            Paragraph paragraph29 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties29 = new ParagraphProperties();

            Tabs tabs9 = new Tabs();
            TabStop tabStop25 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop26 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop27 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop28 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop29 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs9.Append(tabStop25);
            tabs9.Append(tabStop26);
            tabs9.Append(tabStop27);
            tabs9.Append(tabStop28);
            tabs9.Append(tabStop29);
            SpacingBetweenLines spacingBetweenLines23 = new SpacingBetweenLines() { Before = "60", After = "60" };
            Justification justification11 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties29 = new ParagraphMarkRunProperties();
            RunFonts runFonts52 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties29.Append(runFonts52);

            paragraphProperties29.Append(tabs9);
            paragraphProperties29.Append(spacingBetweenLines23);
            paragraphProperties29.Append(justification11);
            paragraphProperties29.Append(paragraphMarkRunProperties29);

            Run run24 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties24 = new RunProperties();
            RunFonts runFonts53 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties24.Append(runFonts53);
            Text text23 = new Text();
            text23.Text = "Discount";

            run24.Append(runProperties24);
            run24.Append(text23);

            paragraph29.Append(paragraphProperties29);
            paragraph29.Append(run24);

            tableCell11.Append(tableCellProperties11);
            tableCell11.Append(paragraph29);

            TableCell tableCell12 = new TableCell();

            TableCellProperties tableCellProperties12 = new TableCellProperties();
            TableCellWidth tableCellWidth12 = new TableCellWidth() { Width = "1078", Type = TableWidthUnitValues.Dxa };

            tableCellProperties12.Append(tableCellWidth12);

            Paragraph paragraph30 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

            ParagraphProperties paragraphProperties30 = new ParagraphProperties();

            Tabs tabs10 = new Tabs();
            TabStop tabStop30 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
            TabStop tabStop31 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
            TabStop tabStop32 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
            TabStop tabStop33 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
            TabStop tabStop34 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs10.Append(tabStop30);
            tabs10.Append(tabStop31);
            tabs10.Append(tabStop32);
            tabs10.Append(tabStop33);
            tabs10.Append(tabStop34);
            SpacingBetweenLines spacingBetweenLines24 = new SpacingBetweenLines() { Before = "60", After = "60" };
            Justification justification12 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties30 = new ParagraphMarkRunProperties();
            RunFonts runFonts54 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties30.Append(runFonts54);

            paragraphProperties30.Append(tabs10);
            paragraphProperties30.Append(spacingBetweenLines24);
            paragraphProperties30.Append(justification12);
            paragraphProperties30.Append(paragraphMarkRunProperties30);

            Run run25 = new Run() { RsidRunProperties = "00443ACA" };

            RunProperties runProperties25 = new RunProperties();
            RunFonts runFonts55 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            runProperties25.Append(runFonts55);
            Text text24 = new Text();
            text24.Text = "Total";

            run25.Append(runProperties25);
            run25.Append(text24);

            paragraph30.Append(paragraphProperties30);
            paragraph30.Append(run25);

            tableCell12.Append(tableCellProperties12);
            tableCell12.Append(paragraph30);

            tableRow4.Append(tableCell7);
            tableRow4.Append(tableCell8);
            tableRow4.Append(tableCell9);
            tableRow4.Append(tableCell10);
            tableRow4.Append(tableCell11);
            tableRow4.Append(tableCell12);

            table2.Append(tableProperties2);
            table2.Append(tableGrid2);
            table2.Append(tableRow4);

            /****** Loop from here? **********/
            foreach (OrderedStock o in orderedStock)
            {
                //Create a table row
                TableRow orderedStockRow = new TableRow() { RsidTableRowAddition = "00443ACA", RsidTableRowProperties = "00506382" };

                //Create cell to hold bookID
                TableCell cellBookID = new TableCell();

                TableCellProperties cellBookIDProperties = new TableCellProperties();
                TableCellWidth cellBookIDWidth = new TableCellWidth() { Width = "1418", Type = TableWidthUnitValues.Dxa };

                cellBookIDProperties.Append(cellBookIDWidth);

                Paragraph paragraph31 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties31 = new ParagraphProperties();

                Tabs tabs11 = new Tabs();
                TabStop tabStop35 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop36 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop37 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop38 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop39 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs11.Append(tabStop35);
                tabs11.Append(tabStop36);
                tabs11.Append(tabStop37);
                tabs11.Append(tabStop38);
                tabs11.Append(tabStop39);
                SpacingBetweenLines spacingBetweenLines25 = new SpacingBetweenLines() { Before = "60", After = "60" };

                ParagraphMarkRunProperties paragraphMarkRunProperties31 = new ParagraphMarkRunProperties();
                RunFonts runFonts56 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize42 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties31.Append(runFonts56);
                paragraphMarkRunProperties31.Append(fontSize42);

                paragraphProperties31.Append(tabs11);
                paragraphProperties31.Append(spacingBetweenLines25);
                paragraphProperties31.Append(paragraphMarkRunProperties31);

                Run run26 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties26 = new RunProperties();
                RunFonts runFonts57 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize43 = new FontSize() { Val = "18" };

                runProperties26.Append(runFonts57);
                runProperties26.Append(fontSize43);
                Text text25 = new Text();

                //TODO Book ID
                text25.Text = o.bookID;

                run26.Append(runProperties26);
                run26.Append(text25);

                paragraph31.Append(paragraphProperties31);
                paragraph31.Append(run26);

                cellBookID.Append(cellBookIDProperties);
                cellBookID.Append(paragraph31);

                //Cell for description
                TableCell tableCell14 = new TableCell();

                TableCellProperties tableCellProperties14 = new TableCellProperties();
                TableCellWidth tableCellWidth14 = new TableCellWidth() { Width = "2719", Type = TableWidthUnitValues.Dxa };

                tableCellProperties14.Append(tableCellWidth14);

                Paragraph paragraph32 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties32 = new ParagraphProperties();

                Tabs tabs12 = new Tabs();
                TabStop tabStop40 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop41 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop42 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop43 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop44 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs12.Append(tabStop40);
                tabs12.Append(tabStop41);
                tabs12.Append(tabStop42);
                tabs12.Append(tabStop43);
                tabs12.Append(tabStop44);
                SpacingBetweenLines spacingBetweenLines26 = new SpacingBetweenLines() { Before = "60", After = "60" };

                ParagraphMarkRunProperties paragraphMarkRunProperties32 = new ParagraphMarkRunProperties();
                RunFonts runFonts58 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize44 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties32.Append(runFonts58);
                paragraphMarkRunProperties32.Append(fontSize44);

                paragraphProperties32.Append(tabs12);
                paragraphProperties32.Append(spacingBetweenLines26);
                paragraphProperties32.Append(paragraphMarkRunProperties32);

                Run run27 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties27 = new RunProperties();
                RunFonts runFonts59 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize45 = new FontSize() { Val = "18" };

                runProperties27.Append(runFonts59);
                runProperties27.Append(fontSize45);
                Text text26 = new Text() { Space = SpaceProcessingModeValues.Preserve };

                //TODO Author name
                string author = o.author;
                text26.Text = author;

                run27.Append(runProperties27);
                run27.Append(text26);
                ProofError proofError3 = new ProofError() { Type = ProofingErrorValues.SpellStart };

                RunProperties runProperties28 = new RunProperties();
                RunFonts runFonts60 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize46 = new FontSize() { Val = "18" };

                runProperties28.Append(runFonts60);
                runProperties28.Append(fontSize46);

                ProofError proofError4 = new ProofError() { Type = ProofingErrorValues.SpellEnd };

                paragraph32.Append(paragraphProperties32);
                paragraph32.Append(run27);
                paragraph32.Append(proofError3);

                Paragraph paragraph33 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties33 = new ParagraphProperties();

                Tabs tabs13 = new Tabs();
                TabStop tabStop45 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop46 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop47 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop48 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop49 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs13.Append(tabStop45);
                tabs13.Append(tabStop46);
                tabs13.Append(tabStop47);
                tabs13.Append(tabStop48);
                tabs13.Append(tabStop49);
                SpacingBetweenLines spacingBetweenLines27 = new SpacingBetweenLines() { Before = "60", After = "60" };

                ParagraphMarkRunProperties paragraphMarkRunProperties33 = new ParagraphMarkRunProperties();
                RunFonts runFonts61 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize47 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties33.Append(runFonts61);
                paragraphMarkRunProperties33.Append(fontSize47);

                paragraphProperties33.Append(tabs13);
                paragraphProperties33.Append(spacingBetweenLines27);
                paragraphProperties33.Append(paragraphMarkRunProperties33);

                Run run29 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties29 = new RunProperties();
                RunFonts runFonts62 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize48 = new FontSize() { Val = "18" };

                runProperties29.Append(runFonts62);
                runProperties29.Append(fontSize48);
                Text text28 = new Text();

                //TODO Book title
                text28.Text = o.title;

                run29.Append(runProperties29);
                run29.Append(text28);

                paragraph33.Append(paragraphProperties33);
                paragraph33.Append(run29);

                tableCell14.Append(tableCellProperties14);
                tableCell14.Append(paragraph32);
                tableCell14.Append(paragraph33);

                //Cell for quantity
                TableCell tableCell15 = new TableCell();

                TableCellProperties tableCellProperties15 = new TableCellProperties();
                TableCellWidth tableCellWidth15 = new TableCellWidth() { Width = "1036", Type = TableWidthUnitValues.Dxa };

                tableCellProperties15.Append(tableCellWidth15);

                Paragraph paragraph34 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties34 = new ParagraphProperties();

                Tabs tabs14 = new Tabs();
                TabStop tabStop50 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop51 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop52 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop53 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop54 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs14.Append(tabStop50);
                tabs14.Append(tabStop51);
                tabs14.Append(tabStop52);
                tabs14.Append(tabStop53);
                tabs14.Append(tabStop54);
                SpacingBetweenLines spacingBetweenLines28 = new SpacingBetweenLines() { Before = "60", After = "60" };
                Justification justification13 = new Justification() { Val = JustificationValues.Right };

                ParagraphMarkRunProperties paragraphMarkRunProperties34 = new ParagraphMarkRunProperties();
                RunFonts runFonts63 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize49 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties34.Append(runFonts63);
                paragraphMarkRunProperties34.Append(fontSize49);

                paragraphProperties34.Append(tabs14);
                paragraphProperties34.Append(spacingBetweenLines28);
                paragraphProperties34.Append(justification13);
                paragraphProperties34.Append(paragraphMarkRunProperties34);

                Run run30 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties30 = new RunProperties();
                RunFonts runFonts64 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize50 = new FontSize() { Val = "18" };

                runProperties30.Append(runFonts64);
                runProperties30.Append(fontSize50);
                Text text29 = new Text();

                //TODO Quantity
                text29.Text = o.quantity.ToString();

                run30.Append(runProperties30);
                run30.Append(text29);

                paragraph34.Append(paragraphProperties34);
                paragraph34.Append(run30);

                tableCell15.Append(tableCellProperties15);
                tableCell15.Append(paragraph34);

                //Cell for price
                TableCell tableCell16 = new TableCell();

                TableCellProperties tableCellProperties16 = new TableCellProperties();
                TableCellWidth tableCellWidth16 = new TableCellWidth() { Width = "1364", Type = TableWidthUnitValues.Dxa };

                tableCellProperties16.Append(tableCellWidth16);

                Paragraph paragraph35 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties35 = new ParagraphProperties();

                Tabs tabs15 = new Tabs();
                TabStop tabStop55 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop56 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop57 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop58 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop59 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs15.Append(tabStop55);
                tabs15.Append(tabStop56);
                tabs15.Append(tabStop57);
                tabs15.Append(tabStop58);
                tabs15.Append(tabStop59);
                SpacingBetweenLines spacingBetweenLines29 = new SpacingBetweenLines() { Before = "60", After = "60" };
                Justification justification14 = new Justification() { Val = JustificationValues.Right };

                ParagraphMarkRunProperties paragraphMarkRunProperties35 = new ParagraphMarkRunProperties();
                RunFonts runFonts65 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize51 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties35.Append(runFonts65);
                paragraphMarkRunProperties35.Append(fontSize51);

                paragraphProperties35.Append(tabs15);
                paragraphProperties35.Append(spacingBetweenLines29);
                paragraphProperties35.Append(justification14);
                paragraphProperties35.Append(paragraphMarkRunProperties35);

                Run run31 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties31 = new RunProperties();
                RunFonts runFonts66 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize52 = new FontSize() { Val = "18" };

                runProperties31.Append(runFonts66);
                runProperties31.Append(fontSize52);
                Text text30 = new Text();

                //TODO Price
                text30.Text = "$" + String.Format("{0:0.00}", o.price);

                run31.Append(runProperties31);
                run31.Append(text30);

                paragraph35.Append(paragraphProperties35);
                paragraph35.Append(run31);

                tableCell16.Append(tableCellProperties16);
                tableCell16.Append(paragraph35);

                //Cell for discount
                TableCell tableCell17 = new TableCell();

                TableCellProperties tableCellProperties17 = new TableCellProperties();
                TableCellWidth tableCellWidth17 = new TableCellWidth() { Width = "1411", Type = TableWidthUnitValues.Dxa };

                tableCellProperties17.Append(tableCellWidth17);

                Paragraph paragraph36 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties36 = new ParagraphProperties();

                Tabs tabs16 = new Tabs();
                TabStop tabStop60 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop61 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop62 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop63 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop64 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs16.Append(tabStop60);
                tabs16.Append(tabStop61);
                tabs16.Append(tabStop62);
                tabs16.Append(tabStop63);
                tabs16.Append(tabStop64);
                SpacingBetweenLines spacingBetweenLines30 = new SpacingBetweenLines() { Before = "60", After = "60" };
                Justification justification15 = new Justification() { Val = JustificationValues.Right };

                ParagraphMarkRunProperties paragraphMarkRunProperties36 = new ParagraphMarkRunProperties();
                RunFonts runFonts67 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize53 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties36.Append(runFonts67);
                paragraphMarkRunProperties36.Append(fontSize53);

                paragraphProperties36.Append(tabs16);
                paragraphProperties36.Append(spacingBetweenLines30);
                paragraphProperties36.Append(justification15);
                paragraphProperties36.Append(paragraphMarkRunProperties36);

                Run run32 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties32 = new RunProperties();
                RunFonts runFonts68 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize54 = new FontSize() { Val = "18" };

                runProperties32.Append(runFonts68);
                runProperties32.Append(fontSize54);
                Text text31 = new Text();

                //TODO Discount
                text31.Text = "$" + String.Format("{0:0.00}", o.discount);

                run32.Append(runProperties32);
                run32.Append(text31);

                paragraph36.Append(paragraphProperties36);
                paragraph36.Append(run32);

                tableCell17.Append(tableCellProperties17);
                tableCell17.Append(paragraph36);

                //Cell for total
                TableCell tableCell18 = new TableCell();

                TableCellProperties tableCellProperties18 = new TableCellProperties();
                TableCellWidth tableCellWidth18 = new TableCellWidth() { Width = "1078", Type = TableWidthUnitValues.Dxa };

                tableCellProperties18.Append(tableCellWidth18);

                Paragraph paragraph37 = new Paragraph() { RsidParagraphMarkRevision = "00443ACA", RsidParagraphAddition = "00443ACA", RsidParagraphProperties = "00443ACA", RsidRunAdditionDefault = "00443ACA" };

                ParagraphProperties paragraphProperties37 = new ParagraphProperties();

                Tabs tabs17 = new Tabs();
                TabStop tabStop65 = new TabStop() { Val = TabStopValues.Left, Position = 1560 };
                TabStop tabStop66 = new TabStop() { Val = TabStopValues.Left, Position = 3969 };
                TabStop tabStop67 = new TabStop() { Val = TabStopValues.Left, Position = 5387 };
                TabStop tabStop68 = new TabStop() { Val = TabStopValues.Left, Position = 6379 };
                TabStop tabStop69 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

                tabs17.Append(tabStop65);
                tabs17.Append(tabStop66);
                tabs17.Append(tabStop67);
                tabs17.Append(tabStop68);
                tabs17.Append(tabStop69);
                SpacingBetweenLines spacingBetweenLines31 = new SpacingBetweenLines() { Before = "60", After = "60" };
                Justification justification16 = new Justification() { Val = JustificationValues.Right };

                ParagraphMarkRunProperties paragraphMarkRunProperties37 = new ParagraphMarkRunProperties();
                RunFonts runFonts69 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize55 = new FontSize() { Val = "18" };

                paragraphMarkRunProperties37.Append(runFonts69);
                paragraphMarkRunProperties37.Append(fontSize55);

                paragraphProperties37.Append(tabs17);
                paragraphProperties37.Append(spacingBetweenLines31);
                paragraphProperties37.Append(justification16);
                paragraphProperties37.Append(paragraphMarkRunProperties37);

                Run run33 = new Run() { RsidRunProperties = "00443ACA" };

                RunProperties runProperties33 = new RunProperties();
                RunFonts runFonts70 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
                FontSize fontSize56 = new FontSize() { Val = "18" };

                runProperties33.Append(runFonts70);
                runProperties33.Append(fontSize56);
                Text text32 = new Text();

                //Total
                double total = o.price - o.discount;

                grandTotal += total;

                //TODO have price display as decimal
                text32.Text = "$" + String.Format("{0:0.00}", total);

                run33.Append(runProperties33);
                run33.Append(text32);

                paragraph37.Append(paragraphProperties37);
                paragraph37.Append(run33);

                tableCell18.Append(tableCellProperties18);
                tableCell18.Append(paragraph37);

                //Add cells into the row
                orderedStockRow.Append(cellBookID);
                orderedStockRow.Append(tableCell14);
                orderedStockRow.Append(tableCell15);
                orderedStockRow.Append(tableCell16);
                orderedStockRow.Append(tableCell17);
                orderedStockRow.Append(tableCell18);

                //Add row for book into the table
                table2.Append(orderedStockRow);
            }
            /***************** End loop *******************/

            Paragraph paragraph38 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00116604", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties38 = new ParagraphProperties();

            Tabs tabs18 = new Tabs();
            TabStop tabStop70 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs18.Append(tabStop70);
            SpacingBetweenLines spacingBetweenLines32 = new SpacingBetweenLines() { Before = "40", After = "40" };

            ParagraphMarkRunProperties paragraphMarkRunProperties38 = new ParagraphMarkRunProperties();
            RunFonts runFonts71 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold5 = new Bold();
            FontSize fontSize57 = new FontSize() { Val = "18" };

            paragraphMarkRunProperties38.Append(runFonts71);
            paragraphMarkRunProperties38.Append(bold5);
            paragraphMarkRunProperties38.Append(fontSize57);

            paragraphProperties38.Append(tabs18);
            paragraphProperties38.Append(spacingBetweenLines32);
            paragraphProperties38.Append(paragraphMarkRunProperties38);

            paragraph38.Append(paragraphProperties38);

            Table table3 = new Table();

            TableProperties tableProperties3 = new TableProperties();
            TableStyle tableStyle3 = new TableStyle() { Val = "TableGrid" };
            TableWidth tableWidth3 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto };
            TableIndentation tableIndentation1 = new TableIndentation() { Width = 6516, Type = TableWidthUnitValues.Dxa };

            TableBorders tableBorders3 = new TableBorders();
            TopBorder topBorder2 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder3 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder2 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder3 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideHorizontalBorder insideHorizontalBorder2 = new InsideHorizontalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideVerticalBorder insideVerticalBorder3 = new InsideVerticalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            tableBorders3.Append(topBorder2);
            tableBorders3.Append(leftBorder3);
            tableBorders3.Append(bottomBorder2);
            tableBorders3.Append(rightBorder3);
            tableBorders3.Append(insideHorizontalBorder2);
            tableBorders3.Append(insideVerticalBorder3);
            TableLook tableLook3 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true };

            tableProperties3.Append(tableStyle3);
            tableProperties3.Append(tableWidth3);
            tableProperties3.Append(tableIndentation1);
            tableProperties3.Append(tableBorders3);
            tableProperties3.Append(tableLook3);

            TableGrid tableGrid3 = new TableGrid();
            GridColumn gridColumn10 = new GridColumn() { Width = "1559" };
            GridColumn gridColumn11 = new GridColumn() { Width = "941" };

            tableGrid3.Append(gridColumn10);
            tableGrid3.Append(gridColumn11);

            TableRow tableRow6 = new TableRow() { RsidTableRowAddition = "00B5104A", RsidTableRowProperties = "00BD60A1" };

            TableCell tableCell19 = new TableCell();

            TableCellProperties tableCellProperties19 = new TableCellProperties();
            TableCellWidth tableCellWidth19 = new TableCellWidth() { Width = "1559", Type = TableWidthUnitValues.Dxa };

            tableCellProperties19.Append(tableCellWidth19);

            Paragraph paragraph39 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00116604", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties39 = new ParagraphProperties();

            Tabs tabs19 = new Tabs();
            TabStop tabStop71 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs19.Append(tabStop71);
            SpacingBetweenLines spacingBetweenLines33 = new SpacingBetweenLines() { Before = "40", After = "40" };

            ParagraphMarkRunProperties paragraphMarkRunProperties39 = new ParagraphMarkRunProperties();
            RunFonts runFonts72 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold6 = new Bold();
            FontSize fontSize58 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties39.Append(runFonts72);
            paragraphMarkRunProperties39.Append(bold6);
            paragraphMarkRunProperties39.Append(fontSize58);

            paragraphProperties39.Append(tabs19);
            paragraphProperties39.Append(spacingBetweenLines33);
            paragraphProperties39.Append(paragraphMarkRunProperties39);

            Run run34 = new Run();

            RunProperties runProperties34 = new RunProperties();
            RunFonts runFonts73 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize59 = new FontSize() { Val = "20" };

            runProperties34.Append(runFonts73);
            runProperties34.Append(fontSize59);
            Text text33 = new Text();
            text33.Text = "Total:";

            run34.Append(runProperties34);
            run34.Append(text33);

            paragraph39.Append(paragraphProperties39);
            paragraph39.Append(run34);

            tableCell19.Append(tableCellProperties19);
            tableCell19.Append(paragraph39);

            TableCell tableCell20 = new TableCell();

            TableCellProperties tableCellProperties20 = new TableCellProperties();
            TableCellWidth tableCellWidth20 = new TableCellWidth() { Width = "941", Type = TableWidthUnitValues.Dxa };

            tableCellProperties20.Append(tableCellWidth20);

            Paragraph paragraph40 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00B5104A", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties40 = new ParagraphProperties();

            Tabs tabs20 = new Tabs();
            TabStop tabStop72 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs20.Append(tabStop72);
            SpacingBetweenLines spacingBetweenLines34 = new SpacingBetweenLines() { Before = "40", After = "40" };
            Justification justification17 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties40 = new ParagraphMarkRunProperties();
            RunFonts runFonts74 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold7 = new Bold();
            FontSize fontSize60 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties40.Append(runFonts74);
            paragraphMarkRunProperties40.Append(bold7);
            paragraphMarkRunProperties40.Append(fontSize60);

            paragraphProperties40.Append(tabs20);
            paragraphProperties40.Append(spacingBetweenLines34);
            paragraphProperties40.Append(justification17);
            paragraphProperties40.Append(paragraphMarkRunProperties40);

            Run run35 = new Run();

            RunProperties runProperties35 = new RunProperties();
            RunFonts runFonts75 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize61 = new FontSize() { Val = "20" };

            runProperties35.Append(runFonts75);
            runProperties35.Append(fontSize61);
            Text text34 = new Text();

            //TODO total after the table
            text34.Text = "$" + String.Format("{0:0.00}", grandTotal);

            run35.Append(runProperties35);
            run35.Append(text34);

            paragraph40.Append(paragraphProperties40);
            paragraph40.Append(run35);

            tableCell20.Append(tableCellProperties20);
            tableCell20.Append(paragraph40);

            tableRow6.Append(tableCell19);
            tableRow6.Append(tableCell20);

            TableRow tableRow7 = new TableRow() { RsidTableRowAddition = "00B5104A", RsidTableRowProperties = "00BD60A1" };

            TableCell tableCell21 = new TableCell();

            TableCellProperties tableCellProperties21 = new TableCellProperties();
            TableCellWidth tableCellWidth21 = new TableCellWidth() { Width = "1559", Type = TableWidthUnitValues.Dxa };

            tableCellProperties21.Append(tableCellWidth21);

            Paragraph paragraph41 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00116604", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties41 = new ParagraphProperties();

            Tabs tabs21 = new Tabs();
            TabStop tabStop73 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs21.Append(tabStop73);
            SpacingBetweenLines spacingBetweenLines35 = new SpacingBetweenLines() { Before = "40", After = "40" };

            ParagraphMarkRunProperties paragraphMarkRunProperties41 = new ParagraphMarkRunProperties();
            RunFonts runFonts76 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize62 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties41.Append(runFonts76);
            paragraphMarkRunProperties41.Append(fontSize62);

            paragraphProperties41.Append(tabs21);
            paragraphProperties41.Append(spacingBetweenLines35);
            paragraphProperties41.Append(paragraphMarkRunProperties41);

            Run run36 = new Run();

            RunProperties runProperties36 = new RunProperties();
            RunFonts runFonts77 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize63 = new FontSize() { Val = "20" };

            runProperties36.Append(runFonts77);
            runProperties36.Append(fontSize63);
            Text text35 = new Text();
            text35.Text = "Freight:";

            run36.Append(runProperties36);
            run36.Append(text35);

            paragraph41.Append(paragraphProperties41);
            paragraph41.Append(run36);

            tableCell21.Append(tableCellProperties21);
            tableCell21.Append(paragraph41);

            TableCell tableCell22 = new TableCell();

            TableCellProperties tableCellProperties22 = new TableCellProperties();
            TableCellWidth tableCellWidth22 = new TableCellWidth() { Width = "941", Type = TableWidthUnitValues.Dxa };

            tableCellProperties22.Append(tableCellWidth22);

            Paragraph paragraph42 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00B5104A", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties42 = new ParagraphProperties();

            Tabs tabs22 = new Tabs();
            TabStop tabStop74 = new TabStop() { Val = TabStopValues.Left, Position = 6663 };
            TabStop tabStop75 = new TabStop() { Val = TabStopValues.Left, Position = 8364 };

            tabs22.Append(tabStop74);
            tabs22.Append(tabStop75);
            SpacingBetweenLines spacingBetweenLines36 = new SpacingBetweenLines() { Before = "40", After = "40" };
            Justification justification18 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties42 = new ParagraphMarkRunProperties();
            RunFonts runFonts78 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize64 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties42.Append(runFonts78);
            paragraphMarkRunProperties42.Append(fontSize64);

            paragraphProperties42.Append(tabs22);
            paragraphProperties42.Append(spacingBetweenLines36);
            paragraphProperties42.Append(justification18);
            paragraphProperties42.Append(paragraphMarkRunProperties42);

            Run run37 = new Run();

            RunProperties runProperties37 = new RunProperties();
            RunFonts runFonts79 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize65 = new FontSize() { Val = "20" };

            runProperties37.Append(runFonts79);
            runProperties37.Append(fontSize65);
            Text text36 = new Text();

            //TODO freight price
            text36.Text = "$" + String.Format("{0:0.00}", order.freightCost);

            run37.Append(runProperties37);
            run37.Append(text36);

            paragraph42.Append(paragraphProperties42);
            paragraph42.Append(run37);

            tableCell22.Append(tableCellProperties22);
            tableCell22.Append(paragraph42);

            tableRow7.Append(tableCell21);
            tableRow7.Append(tableCell22);

            TableRow tableRow8 = new TableRow() { RsidTableRowAddition = "00B5104A", RsidTableRowProperties = "00BD60A1" };

            TableCell tableCell23 = new TableCell();

            TableCellProperties tableCellProperties23 = new TableCellProperties();
            TableCellWidth tableCellWidth23 = new TableCellWidth() { Width = "1559", Type = TableWidthUnitValues.Dxa };

            tableCellProperties23.Append(tableCellWidth23);

            Paragraph paragraph43 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00116604", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties43 = new ParagraphProperties();

            Tabs tabs23 = new Tabs();
            TabStop tabStop76 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs23.Append(tabStop76);
            SpacingBetweenLines spacingBetweenLines37 = new SpacingBetweenLines() { Before = "40", After = "40" };

            ParagraphMarkRunProperties paragraphMarkRunProperties43 = new ParagraphMarkRunProperties();
            RunFonts runFonts80 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize66 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties43.Append(runFonts80);
            paragraphMarkRunProperties43.Append(fontSize66);

            paragraphProperties43.Append(tabs23);
            paragraphProperties43.Append(spacingBetweenLines37);
            paragraphProperties43.Append(paragraphMarkRunProperties43);

            Run run38 = new Run() { RsidRunProperties = "00690638" };

            RunProperties runProperties38 = new RunProperties();
            RunFonts runFonts81 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold8 = new Bold();
            FontSize fontSize67 = new FontSize() { Val = "20" };

            runProperties38.Append(runFonts81);
            runProperties38.Append(bold8);
            runProperties38.Append(fontSize67);
            Text text37 = new Text();
            text37.Text = "Final Total";

            run38.Append(runProperties38);
            run38.Append(text37);

            Run run39 = new Run();

            RunProperties runProperties39 = new RunProperties();
            RunFonts runFonts82 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold9 = new Bold();
            FontSize fontSize68 = new FontSize() { Val = "20" };

            runProperties39.Append(runFonts82);
            runProperties39.Append(bold9);
            runProperties39.Append(fontSize68);
            Text text38 = new Text();
            text38.Text = ":";

            run39.Append(runProperties39);
            run39.Append(text38);

            paragraph43.Append(paragraphProperties43);
            paragraph43.Append(run38);
            paragraph43.Append(run39);

            tableCell23.Append(tableCellProperties23);
            tableCell23.Append(paragraph43);

            TableCell tableCell24 = new TableCell();

            TableCellProperties tableCellProperties24 = new TableCellProperties();
            TableCellWidth tableCellWidth24 = new TableCellWidth() { Width = "941", Type = TableWidthUnitValues.Dxa };

            tableCellProperties24.Append(tableCellWidth24);

            Paragraph paragraph44 = new Paragraph() { RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00B5104A", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties44 = new ParagraphProperties();

            Tabs tabs24 = new Tabs();
            TabStop tabStop77 = new TabStop() { Val = TabStopValues.Left, Position = 6663 };
            TabStop tabStop78 = new TabStop() { Val = TabStopValues.Left, Position = 8364 };

            tabs24.Append(tabStop77);
            tabs24.Append(tabStop78);
            SpacingBetweenLines spacingBetweenLines38 = new SpacingBetweenLines() { Before = "40", After = "40" };
            Justification justification19 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties44 = new ParagraphMarkRunProperties();
            RunFonts runFonts83 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize69 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties44.Append(runFonts83);
            paragraphMarkRunProperties44.Append(fontSize69);

            paragraphProperties44.Append(tabs24);
            paragraphProperties44.Append(spacingBetweenLines38);
            paragraphProperties44.Append(justification19);
            paragraphProperties44.Append(paragraphMarkRunProperties44);

            Run run40 = new Run() { RsidRunProperties = "00690638" };

            RunProperties runProperties40 = new RunProperties();
            RunFonts runFonts84 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold10 = new Bold();
            FontSize fontSize70 = new FontSize() { Val = "20" };

            runProperties40.Append(runFonts84);
            runProperties40.Append(bold10);
            runProperties40.Append(fontSize70);
            Text text39 = new Text();

            //TODO add in total + freightCost
            double finalTotal = grandTotal + order.freightCost;

            text39.Text = "$" + String.Format("{0:0.00}", finalTotal);

            run40.Append(runProperties40);
            run40.Append(text39);

            paragraph44.Append(paragraphProperties44);
            paragraph44.Append(run40);

            tableCell24.Append(tableCellProperties24);
            tableCell24.Append(paragraph44);

            tableRow8.Append(tableCell23);
            tableRow8.Append(tableCell24);

            TableRow tableRow9 = new TableRow() { RsidTableRowAddition = "00B5104A", RsidTableRowProperties = "00BD60A1" };

            TableCell tableCell25 = new TableCell();

            TableCellProperties tableCellProperties25 = new TableCellProperties();
            TableCellWidth tableCellWidth25 = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Dxa };
            GridSpan gridSpan4 = new GridSpan() { Val = 2 };

            tableCellProperties25.Append(tableCellWidth25);
            tableCellProperties25.Append(gridSpan4);

            Paragraph paragraph45 = new Paragraph() { RsidParagraphMarkRevision = "00690638", RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00B5104A", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties45 = new ParagraphProperties();

            Tabs tabs25 = new Tabs();
            TabStop tabStop79 = new TabStop() { Val = TabStopValues.Left, Position = 6663 };
            TabStop tabStop80 = new TabStop() { Val = TabStopValues.Left, Position = 8364 };

            tabs25.Append(tabStop79);
            tabs25.Append(tabStop80);
            SpacingBetweenLines spacingBetweenLines39 = new SpacingBetweenLines() { Before = "40", After = "40" };
            Justification justification20 = new Justification() { Val = JustificationValues.Right };

            ParagraphMarkRunProperties paragraphMarkRunProperties45 = new ParagraphMarkRunProperties();
            RunFonts runFonts85 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold11 = new Bold();
            FontSize fontSize71 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties45.Append(runFonts85);
            paragraphMarkRunProperties45.Append(bold11);
            paragraphMarkRunProperties45.Append(fontSize71);

            paragraphProperties45.Append(tabs25);
            paragraphProperties45.Append(spacingBetweenLines39);
            paragraphProperties45.Append(justification20);
            paragraphProperties45.Append(paragraphMarkRunProperties45);

            Run run41 = new Run() { RsidRunProperties = "00882792" };

            RunProperties runProperties41 = new RunProperties();
            RunFonts runFonts86 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold12 = new Bold();
            FontSize fontSize72 = new FontSize() { Val = "18" };

            runProperties41.Append(runFonts86);
            runProperties41.Append(bold12);
            runProperties41.Append(fontSize72);
            Text text40 = new Text();
            text40.Text = "Paid in Full";

            run41.Append(runProperties41);
            run41.Append(text40);

            paragraph45.Append(paragraphProperties45);
            paragraph45.Append(run41);

            tableCell25.Append(tableCellProperties25);
            tableCell25.Append(paragraph45);

            tableRow9.Append(tableCell25);

            table3.Append(tableProperties3);
            table3.Append(tableGrid3);
            table3.Append(tableRow6);
            table3.Append(tableRow7);
            table3.Append(tableRow8);
            table3.Append(tableRow9);

            Paragraph paragraph46 = new Paragraph() { RsidParagraphMarkRevision = "00690638", RsidParagraphAddition = "00B5104A", RsidParagraphProperties = "00116604", RsidRunAdditionDefault = "00B5104A" };

            ParagraphProperties paragraphProperties46 = new ParagraphProperties();

            Tabs tabs26 = new Tabs();
            TabStop tabStop81 = new TabStop() { Val = TabStopValues.Left, Position = 7938 };

            tabs26.Append(tabStop81);
            SpacingBetweenLines spacingBetweenLines40 = new SpacingBetweenLines() { Before = "40", After = "40" };

            ParagraphMarkRunProperties paragraphMarkRunProperties46 = new ParagraphMarkRunProperties();
            RunFonts runFonts87 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold13 = new Bold();
            FontSize fontSize73 = new FontSize() { Val = "20" };

            paragraphMarkRunProperties46.Append(runFonts87);
            paragraphMarkRunProperties46.Append(bold13);
            paragraphMarkRunProperties46.Append(fontSize73);

            paragraphProperties46.Append(tabs26);
            paragraphProperties46.Append(spacingBetweenLines40);
            paragraphProperties46.Append(paragraphMarkRunProperties46);

            paragraph46.Append(paragraphProperties46);

            SectionProperties sectionProperties3 = new SectionProperties() { RsidRPr = "00690638", RsidR = "00B5104A", RsidSect = "00EA7D1E" };
            SectionType sectionType2 = new SectionType() { Val = SectionMarkValues.Continuous };
            PageSize pageSize3 = new PageSize() { Width = (UInt32Value)11906U, Height = (UInt32Value)16838U };
            PageMargin pageMargin3 = new PageMargin() { Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)708U, Footer = (UInt32Value)708U, Gutter = (UInt32Value)0U };
            Columns columns3 = new Columns() { Space = "286" };
            DocGrid docGrid3 = new DocGrid() { LinePitch = 360 };

            sectionProperties3.Append(sectionType2);
            sectionProperties3.Append(pageSize3);
            sectionProperties3.Append(pageMargin3);
            sectionProperties3.Append(columns3);
            sectionProperties3.Append(docGrid3);

            body1.Append(paragraph1);
            body1.Append(paragraph2);
            body1.Append(paragraph3);
            body1.Append(paragraph4);
            body1.Append(paragraph5);
            body1.Append(paragraph6);
            body1.Append(paragraph7);
            body1.Append(paragraph8);

            if (customer != null)
            {
                if (customer.firstName != "" || customer.lastName != "")
                    body1.Append(paragraph9);
            }
            else
            {
                if(order.firstName != "" || order.lastName != "")
                    body1.Append(paragraph9);
            }

            if (customer.institution != "")
                body1.Append(paragraphInstitute);
            if(customer.address1 != "")
                body1.Append(paragraph10);
            if(customer.address2 != "")
                body1.Append(paragraph11);
            if(customer.address3 != "")
                body1.Append(paragraph12);
            if(customer.postCode != "")
                body1.Append(paragraph13);
            if(customer.country != "")
                body1.Append(paragraph14);
            body1.Append(paragraph15);
            body1.Append(table1);
            body1.Append(paragraph22);
            body1.Append(paragraph23);
            body1.Append(paragraph24);
            body1.Append(table2);
            body1.Append(paragraph38);
            body1.Append(table3);
            body1.Append(paragraph46);
            body1.Append(sectionProperties3);

            document1.Append(body1);

            mainDocumentPart1.Document = document1;
        }