Click here to Skip to main content
12,887,921 members (38,047 online)
Click here to Skip to main content


42 bookmarked
Posted 3 Aug 2008

Document and Code Generation by LINQ and XSL

, 3 Aug 2008 CPOL
An article on how to generate source code as well as populate Excel Spreadsheets.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="" xmlns:r=""><dimension ref="A1:O46"/><sheetViews><sheetView showGridLines="0" tabSelected="1" workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="12.75"/><cols><col min="1" max="1" width="4.42578125" style="1" customWidth="1"/><col min="2" max="2" width="9.140625" style="1"/><col min="3" max="3" width="11.85546875" style="1" customWidth="1"/><col min="4" max="4" width="13.42578125" style="1" customWidth="1"/><col min="5" max="5" width="2.28515625" style="1" customWidth="1"/><col min="6" max="6" width="6" style="1" customWidth="1"/><col min="7" max="7" width="5.140625" style="1" customWidth="1"/><col min="8" max="8" width="4" style="1" customWidth="1"/><col min="9" max="9" width="7.42578125" style="1" customWidth="1"/><col min="10" max="10" width="4.140625" style="1" customWidth="1"/><col min="11" max="11" width="4.85546875" style="1" customWidth="1"/><col min="12" max="12" width="11.28515625" style="1" customWidth="1"/><col min="13" max="13" width="12.85546875" style="1" bestFit="1" customWidth="1"/><col min="14" max="14" width="6" style="1" customWidth="1"/><col min="15" max="16384" width="9.140625" style="1"/></cols><sheetData><row r="1" spans="1:15" ht="23.25"><c r="C1" s="7" t="s"><v>15</v></c><c r="O1" s="9"/></row><row r="2" spans="1:15" ht="15.75"><c r="C2" s="8" t="s"><v>16</v></c><c r="O2" s="9"/></row><row r="3" spans="1:15" ht="15.75"><c r="C3" s="8" t="s"><v>17</v></c><c r="O3" s="9"/></row><row r="4" spans="1:15" ht="15.75"><c r="C4" s="8" t="s"><v>18</v></c><c r="O4" s="9"/></row><row r="5" spans="1:15"><c r="O5" s="9"/></row><row r="6" spans="1:15"><c r="O6" s="9"/></row><row r="7" spans="1:15" ht="15" customHeight="1"><c r="B7" s="6" t="s"><v>5</v></c><c r="C7" s="41"/><c r="D7" s="41"/><c r="E7" s="41"/><c r="F7" s="41"/><c r="G7" s="41"/><c r="H7" s="41"/><c r="I7" s="41"/><c r="L7" s="6" t="s"><v>3</v></c><c r="M7" s="2"/><c r="O7" s="9"/></row><row r="8" spans="1:15" ht="15" customHeight="1"><c r="B8" s="6" t="s"><v>0</v></c><c r="C8" s="42"/><c r="D8" s="42"/><c r="E8" s="4"/><c r="F8" s="4"/><c r="G8" s="4"/><c r="H8" s="4"/><c r="I8" s="4"/><c r="L8" s="6" t="s"><v>4</v></c><c r="M8" s="2"/><c r="O8" s="9"/></row><row r="9" spans="1:15" ht="15" customHeight="1"><c r="B9" s="6" t="s"><v>6</v></c><c r="C9" s="42"/><c r="D9" s="42"/><c r="F9" s="26" t="s"><v>1</v></c><c r="G9" s="4"/><c r="H9" s="25" t="s"><v>2</v></c><c r="I9" s="4"/><c r="O9" s="9"/></row><row r="10" spans="1:15" ht="15" customHeight="1"><c r="B10" s="6" t="s"><v>7</v></c><c r="C10" s="42"/><c r="D10" s="42"/><c r="F10" s="27"/><c r="O10" s="9"/></row><row r="11" spans="1:15" ht="15" customHeight="1"><c r="B11" s="3"/><c r="C11" s="3"/><c r="D11" s="3"/><c r="E11" s="3"/><c r="F11" s="3"/><c r="G11" s="3"/><c r="H11" s="3"/><c r="I11" s="3"/><c r="J11" s="3"/><c r="K11" s="3"/><c r="L11" s="3"/><c r="M11" s="3"/><c r="O11" s="9"/></row><row r="12" spans="1:15" ht="15" customHeight="1"><c r="A12" s="5"/><c r="B12" s="24" t="s"><v>8</v></c><c r="C12" s="24" t="s"><v>3</v></c><c r="D12" s="32" t="s"><v>9</v></c><c r="E12" s="33"/><c r="F12" s="33"/><c r="G12" s="33"/><c r="H12" s="33"/><c r="I12" s="33"/><c r="J12" s="33"/><c r="K12" s="34"/><c r="L12" s="24" t="s"><v>10</v></c><c r="M12" s="28" t="s"><v>11</v></c><c r="O12" s="9"/></row><row r="13" spans="1:15" ht="15" customHeight="1"><c r="A13" s="5"/><c r="B13" s="13"/><c r="C13" s="43"/><c r="D13" s="35"/><c r="E13" s="36"/><c r="F13" s="36"/><c r="G13" s="36"/><c r="H13" s="36"/><c r="I13" s="36"/><c r="J13" s="36"/><c r="K13" s="37"/><c r="L13" s="10"/><c r="M13" s="11" t="str"><f>IF(B13&lt;&gt;"",B13*L13,"")</f><v/></c><c r="O13" s="9"/></row><row r="14" spans="1:15" ht="15" customHeight="1"><c r="A14" s="5"/><c r="B14" s="13"/><c r="C14" s="43"/><c r="D14" s="29"/><c r="E14" s="30"/><c r="F14" s="30"/><c r="G14" s="30"/><c r="H14" s="30"/><c r="I14" s="30"/><c r="J14" s="30"/><c r="K14" s="31"/><c r="L14" s="10"/><c r="M14" s="11" t="str"><f t="shared" ref="M14:M35" si="0">IF(B14&lt;&gt;"",B14*L14,"")</f><v/></c><c r="O14" s="9"/></row><row r="15" spans="1:15" ht="15" customHeight="1"><c r="A15" s="5"/><c r="B15" s="13"/><c r="C15" s="43"/><c r="D15" s="29"/><c r="E15" s="30"/><c r="F15" s="30"/><c r="G15" s="30"/><c r="H15" s="30"/><c r="I15" s="30"/><c r="J15" s="30"/><c r="K15" s="31"/><c r="L15" s="10"/><c r="M15" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O15" s="9"/></row><row r="16" spans="1:15" ht="15" customHeight="1"><c r="A16" s="5"/><c r="B16" s="13"/><c r="C16" s="43"/><c r="D16" s="29"/><c r="E16" s="30"/><c r="F16" s="30"/><c r="G16" s="30"/><c r="H16" s="30"/><c r="I16" s="30"/><c r="J16" s="30"/><c r="K16" s="31"/><c r="L16" s="10"/><c r="M16" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O16" s="9"/></row><row r="17" spans="1:15" ht="15" customHeight="1"><c r="A17" s="5"/><c r="B17" s="13"/><c r="C17" s="43"/><c r="D17" s="29"/><c r="E17" s="30"/><c r="F17" s="30"/><c r="G17" s="30"/><c r="H17" s="30"/><c r="I17" s="30"/><c r="J17" s="30"/><c r="K17" s="31"/><c r="L17" s="10"/><c r="M17" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O17" s="9"/></row><row r="18" spans="1:15" ht="15" customHeight="1"><c r="A18" s="5"/><c r="B18" s="13"/><c r="C18" s="43"/><c r="D18" s="29"/><c r="E18" s="30"/><c r="F18" s="30"/><c r="G18" s="30"/><c r="H18" s="30"/><c r="I18" s="30"/><c r="J18" s="30"/><c r="K18" s="31"/><c r="L18" s="10"/><c r="M18" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O18" s="9"/></row><row r="19" spans="1:15" ht="15" customHeight="1"><c r="A19" s="5"/><c r="B19" s="13"/><c r="C19" s="43"/><c r="D19" s="29"/><c r="E19" s="30"/><c r="F19" s="30"/><c r="G19" s="30"/><c r="H19" s="30"/><c r="I19" s="30"/><c r="J19" s="30"/><c r="K19" s="31"/><c r="L19" s="10"/><c r="M19" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O19" s="9"/></row><row r="20" spans="1:15" ht="15" customHeight="1"><c r="A20" s="5"/><c r="B20" s="13"/><c r="C20" s="43"/><c r="D20" s="29"/><c r="E20" s="30"/><c r="F20" s="30"/><c r="G20" s="30"/><c r="H20" s="30"/><c r="I20" s="30"/><c r="J20" s="30"/><c r="K20" s="31"/><c r="L20" s="10"/><c r="M20" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O20" s="9"/></row><row r="21" spans="1:15" ht="15" customHeight="1"><c r="A21" s="5"/><c r="B21" s="13"/><c r="C21" s="43"/><c r="D21" s="29"/><c r="E21" s="30"/><c r="F21" s="30"/><c r="G21" s="30"/><c r="H21" s="30"/><c r="I21" s="30"/><c r="J21" s="30"/><c r="K21" s="31"/><c r="L21" s="10"/><c r="M21" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O21" s="9"/></row><row r="22" spans="1:15" ht="15" customHeight="1"><c r="A22" s="5"/><c r="B22" s="13"/><c r="C22" s="43"/><c r="D22" s="29"/><c r="E22" s="30"/><c r="F22" s="30"/><c r="G22" s="30"/><c r="H22" s="30"/><c r="I22" s="30"/><c r="J22" s="30"/><c r="K22" s="31"/><c r="L22" s="10"/><c r="M22" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O22" s="9"/></row><row r="23" spans="1:15" ht="15" customHeight="1"><c r="A23" s="5"/><c r="B23" s="13"/><c r="C23" s="43"/><c r="D23" s="29"/><c r="E23" s="30"/><c r="F23" s="30"/><c r="G23" s="30"/><c r="H23" s="30"/><c r="I23" s="30"/><c r="J23" s="30"/><c r="K23" s="31"/><c r="L23" s="10"/><c r="M23" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O23" s="9"/></row><row r="24" spans="1:15" ht="15" customHeight="1"><c r="A24" s="5"/><c r="B24" s="13"/><c r="C24" s="43"/><c r="D24" s="29"/><c r="E24" s="30"/><c r="F24" s="30"/><c r="G24" s="30"/><c r="H24" s="30"/><c r="I24" s="30"/><c r="J24" s="30"/><c r="K24" s="31"/><c r="L24" s="10"/><c r="M24" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O24" s="9"/></row><row r="25" spans="1:15" ht="15" customHeight="1"><c r="A25" s="5"/><c r="B25" s="13"/><c r="C25" s="43"/><c r="D25" s="29"/><c r="E25" s="30"/><c r="F25" s="30"/><c r="G25" s="30"/><c r="H25" s="30"/><c r="I25" s="30"/><c r="J25" s="30"/><c r="K25" s="31"/><c r="L25" s="10"/><c r="M25" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O25" s="9"/></row><row r="26" spans="1:15" ht="15" customHeight="1"><c r="A26" s="5"/><c r="B26" s="13"/><c r="C26" s="43"/><c r="D26" s="29"/><c r="E26" s="30"/><c r="F26" s="30"/><c r="G26" s="30"/><c r="H26" s="30"/><c r="I26" s="30"/><c r="J26" s="30"/><c r="K26" s="31"/><c r="L26" s="10"/><c r="M26" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O26" s="9"/></row><row r="27" spans="1:15" ht="15" customHeight="1"><c r="A27" s="5"/><c r="B27" s="13"/><c r="C27" s="43"/><c r="D27" s="29"/><c r="E27" s="30"/><c r="F27" s="30"/><c r="G27" s="30"/><c r="H27" s="30"/><c r="I27" s="30"/><c r="J27" s="30"/><c r="K27" s="31"/><c r="L27" s="10"/><c r="M27" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O27" s="9"/></row><row r="28" spans="1:15" ht="15" customHeight="1"><c r="A28" s="5"/><c r="B28" s="13"/><c r="C28" s="43"/><c r="D28" s="29"/><c r="E28" s="30"/><c r="F28" s="30"/><c r="G28" s="30"/><c r="H28" s="30"/><c r="I28" s="30"/><c r="J28" s="30"/><c r="K28" s="31"/><c r="L28" s="10"/><c r="M28" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O28" s="9"/></row><row r="29" spans="1:15" ht="15" customHeight="1"><c r="A29" s="5"/><c r="B29" s="13"/><c r="C29" s="43"/><c r="D29" s="29"/><c r="E29" s="30"/><c r="F29" s="30"/><c r="G29" s="30"/><c r="H29" s="30"/><c r="I29" s="30"/><c r="J29" s="30"/><c r="K29" s="31"/><c r="L29" s="10"/><c r="M29" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O29" s="9"/></row><row r="30" spans="1:15" ht="15" customHeight="1"><c r="A30" s="5"/><c r="B30" s="13"/><c r="C30" s="43"/><c r="D30" s="29"/><c r="E30" s="30"/><c r="F30" s="30"/><c r="G30" s="30"/><c r="H30" s="30"/><c r="I30" s="30"/><c r="J30" s="30"/><c r="K30" s="31"/><c r="L30" s="10"/><c r="M30" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O30" s="9"/></row><row r="31" spans="1:15" ht="15" customHeight="1"><c r="A31" s="5"/><c r="B31" s="13"/><c r="C31" s="43"/><c r="D31" s="29"/><c r="E31" s="30"/><c r="F31" s="30"/><c r="G31" s="30"/><c r="H31" s="30"/><c r="I31" s="30"/><c r="J31" s="30"/><c r="K31" s="31"/><c r="L31" s="10"/><c r="M31" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O31" s="9"/></row><row r="32" spans="1:15" ht="15" customHeight="1"><c r="A32" s="5"/><c r="B32" s="13"/><c r="C32" s="43"/><c r="D32" s="29"/><c r="E32" s="30"/><c r="F32" s="30"/><c r="G32" s="30"/><c r="H32" s="30"/><c r="I32" s="30"/><c r="J32" s="30"/><c r="K32" s="31"/><c r="L32" s="10"/><c r="M32" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O32" s="9"/></row><row r="33" spans="1:15" ht="15" customHeight="1"><c r="A33" s="5"/><c r="B33" s="13"/><c r="C33" s="43"/><c r="D33" s="29"/><c r="E33" s="30"/><c r="F33" s="30"/><c r="G33" s="30"/><c r="H33" s="30"/><c r="I33" s="30"/><c r="J33" s="30"/><c r="K33" s="31"/><c r="L33" s="10"/><c r="M33" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O33" s="9"/></row><row r="34" spans="1:15" ht="15" customHeight="1"><c r="A34" s="5"/><c r="B34" s="13"/><c r="C34" s="43"/><c r="D34" s="29"/><c r="E34" s="30"/><c r="F34" s="30"/><c r="G34" s="30"/><c r="H34" s="30"/><c r="I34" s="30"/><c r="J34" s="30"/><c r="K34" s="31"/><c r="L34" s="10"/><c r="M34" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O34" s="9"/></row><row r="35" spans="1:15" ht="15" customHeight="1"><c r="A35" s="5"/><c r="B35" s="14"/><c r="C35" s="44"/><c r="D35" s="38"/><c r="E35" s="39"/><c r="F35" s="39"/><c r="G35" s="39"/><c r="H35" s="39"/><c r="I35" s="39"/><c r="J35" s="39"/><c r="K35" s="40"/><c r="L35" s="10"/><c r="M35" s="11" t="str"><f t="shared" si="0"/><v/></c><c r="O35" s="9"/></row><row r="36" spans="1:15" ht="15" customHeight="1"><c r="B36" s="22"><f>SUM(B13:B35)</f><v>0</v></c><c r="C36" s="23" t="s"><v>8</v></c><c r="L36" s="15" t="s"><v>12</v></c><c r="M36" s="19"><f>SUM(M13:M35)</f><v>0</v></c><c r="O36" s="9"/></row><row r="37" spans="1:15" ht="15" customHeight="1"><c r="L37" s="16" t="s"><v>13</v></c><c r="M37" s="19"><v>0</v></c><c r="O37" s="9"/></row><row r="38" spans="1:15" ht="15" customHeight="1"><c r="K38" s="17" t="s"><v>14</v></c><c r="L38" s="18"><v>0</v></c><c r="M38" s="12" t="str"><f>IF(M36&gt;0,IF(L38&lt;&gt;"",L38*M36,""),"")</f><v/></c><c r="O38" s="9"/></row><row r="39" spans="1:15" ht="15" customHeight="1"><c r="O39" s="9"/></row><row r="40" spans="1:15" ht="15" customHeight="1"><c r="L40" s="20" t="s"><v>11</v></c><c r="M40" s="21"><f>SUM(M36:M38)</f><v>0</v></c><c r="O40" s="9"/></row><row r="41" spans="1:15" ht="15" customHeight="1"><c r="O41" s="9"/></row><row r="42" spans="1:15" ht="15" customHeight="1"><c r="O42" s="9"/></row><row r="43" spans="1:15" ht="15" customHeight="1"><c r="O43" s="9"/></row><row r="44" spans="1:15" ht="15" customHeight="1"><c r="O44" s="9"/></row><row r="45" spans="1:15" ht="15" customHeight="1"><c r="A45" s="9"/><c r="B45" s="9"/><c r="C45" s="9"/><c r="D45" s="9"/><c r="E45" s="9"/><c r="F45" s="9"/><c r="G45" s="9"/><c r="H45" s="9"/><c r="I45" s="9"/><c r="J45" s="9"/><c r="K45" s="9"/><c r="L45" s="9"/><c r="M45" s="9"/><c r="N45" s="9"/><c r="O45" s="9"/></row><row r="46" spans="1:15"><c r="A46" s="9"/><c r="B46" s="9"/><c r="C46" s="9"/><c r="D46" s="9"/><c r="E46" s="9"/><c r="F46" s="9"/><c r="G46" s="9"/><c r="H46" s="9"/><c r="I46" s="9"/><c r="J46" s="9"/><c r="K46" s="9"/><c r="L46" s="9"/><c r="M46" s="9"/><c r="N46" s="9"/><c r="O46" s="9"/></row></sheetData><mergeCells count="28"><mergeCell ref="C7:I7"/><mergeCell ref="C8:D8"/><mergeCell ref="C9:D9"/><mergeCell ref="C10:D10"/><mergeCell ref="D30:K30"/><mergeCell ref="D24:K24"/><mergeCell ref="D25:K25"/><mergeCell ref="D26:K26"/><mergeCell ref="D27:K27"/><mergeCell ref="D28:K28"/><mergeCell ref="D29:K29"/><mergeCell ref="D18:K18"/><mergeCell ref="D19:K19"/><mergeCell ref="D20:K20"/><mergeCell ref="D21:K21"/><mergeCell ref="D22:K22"/><mergeCell ref="D31:K31"/><mergeCell ref="D32:K32"/><mergeCell ref="D33:K33"/><mergeCell ref="D34:K34"/><mergeCell ref="D35:K35"/><mergeCell ref="D23:K23"/><mergeCell ref="D12:K12"/><mergeCell ref="D13:K13"/><mergeCell ref="D14:K14"/><mergeCell ref="D15:K15"/><mergeCell ref="D16:K16"/><mergeCell ref="D17:K17"/></mergeCells><pageMargins left="0.25" right="0.25" top="0.75" bottom="0.75" header="0.3" footer="0.3"/><pageSetup orientation="portrait" r:id="rId1"/><drawing r:id="rId2"/></worksheet>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dave Elliott
Software Developer (Senior) Webbert Solutions
United States United States
Dave is an independent consultant working in a variety of industries utilizing Microsoft .NET technologies.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 3 Aug 2008
Article Copyright 2008 by Dave Elliott
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid