473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Workseets in Excel using XSLT transforms form XML(ASP.Net)

1 New Member
How does one introduce multiple worksheets in a excel using Xslt Transforms
my code... Please suggest

Expand|Select|Wrap|Line Numbers
  1. <xsl:stylesheet
  2.     version="1.0"
  3.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.     xmlns:o="urn:schemas-microsoft-com:office:office"
  5.     xmlns:x="urn:schemas-microsoft-com:office:excel">
  6.   <xsl:output method="html" encoding="UTF-8"/>
  7.   <xsl:template match="/">
  8.     <html>
  9.       <head>
  10.         <title></title>
  11.         <xml>
  12.           <x:ExcelWorkbook>
  13.             <x:ExcelWorksheets>
  14.               <x:ExcelWorksheet>
  15.                 <x:Name>Sheet 1</x:Name>
  16.                 <x:Table>
  17.                 <xsl:apply-templates select="DeptData"></xsl:apply-templates>
  18.                 </x:Table>
  19.                 <x:WorksheetOptions>
  20.                   <x:DefaultRowHeight>210</x:DefaultRowHeight>
  21.                   <x:Print>
  22.                     <x:FitHeight>0</x:FitHeight>
  23.                     <x:ValidPrinterInfo/>
  24.                     <x:Scale>100</x:Scale>
  25.                     <x:HorizontalResolution>600</x:HorizontalResolution>
  26.                     <x:VerticalResolution>600</x:VerticalResolution>
  27.                   </x:Print>
  28.                   <x:Selected/>
  29.                   <x:DoNotDisplayGridlines>False</x:DoNotDisplayGridlines>
  30.                   <x:ProtectContents>False</x:ProtectContents>
  31.                   <x:ProtectObjects>False</x:ProtectObjects>
  32.                   <x:ProtectScenarios>False</x:ProtectScenarios>
  33.                 </x:WorksheetOptions>
  34.                 <x:PageBreaks>
  35.                 </x:PageBreaks>
  36.               </x:ExcelWorksheet>
  37.               <x:ExcelWorksheet>
  38.                 <x:Name>Sheet 2</x:Name>
  39.                 <x:Table>
  40.                   <xsl:apply-templates select="EmpData"></xsl:apply-templates>
  41.                 </x:Table>
  42.                 <x:WorksheetOptions>
  43.                   <x:DefaultRowHeight>210</x:DefaultRowHeight>
  44.                   <x:Print>
  45.                     <x:FitHeight>0</x:FitHeight>
  46.                     <x:ValidPrinterInfo/>
  47.                     <x:Scale>100</x:Scale>
  48.                     <x:HorizontalResolution>600</x:HorizontalResolution>
  49.                     <x:VerticalResolution>600</x:VerticalResolution>
  50.                   </x:Print>
  51.                   <x:Selected/>
  52.                   <x:DoNotDisplayGridlines>False</x:DoNotDisplayGridlines>
  53.                   <x:ProtectContents>False</x:ProtectContents>
  54.                   <x:ProtectObjects>False</x:ProtectObjects>
  55.                   <x:ProtectScenarios>False</x:ProtectScenarios>
  56.                 </x:WorksheetOptions>
  57.                 <x:PageBreaks>
  58.                 </x:PageBreaks>
  59.               </x:ExcelWorksheet>    
  60.             <x:ProtectStructure>False</x:ProtectStructure>
  61.             <x:ProtectWindows>False</x:ProtectWindows>
  62.               </x:ExcelWorksheets>
  63.           </x:ExcelWorkbook>
  64.         </xml>
  65.       </head>
  66.       <body>
  67.         <table>
  68.           <tr>
  69.             <td >Group</td>
  70.             <td >Code</td>
  71.           </tr>
  72.           <xsl:for-each select="//ResultItemDeptSearch">
  73.             <tr>
  74.               <td >
  75.                 <xsl:value-of select="Group" />
  76.               </td>
  77.               <td >
  78.                 <xsl:value-of select="Dept" />
  79.               </td>
  80.             </tr>
  81.           </xsl:for-each>
  82.         </table>
  83.       </body>
  84.       <body>
  85.         <table>
  86.           <tr>
  87.             <td >Business Group</td>
  88.             <td >Department Code</td>
  89.           </tr>
  90.           <xsl:for-each select="//ResultItemDeptSearch">
  91.             <tr>
  92.               <td >
  93.                 <xsl:value-of select="BusinessGroup" />
  94.               </td>
  95.               <td >
  96.                 <xsl:value-of select="DeptCode" />
  97.               </td>
  98.             </tr>
  99.           </xsl:for-each>
  100.         </table>
  101.       </body>
  102.     </html>
  103.   </xsl:template>
  104.   </xsl:stylesheet>
  105.  
this is putting all the data in sheet 1
sheet 2 is blank
Aug 21 '07 #1
4 7116
jkmyoung
2,057 Recognized Expert Top Contributor
Would need to see your xml source, but I'm guessing that the
EmpData nodes are not at the same level as the DeptData nodes.

I'm assuming you have not listed your templates for EmpData and DeptData?

Are employees under the Dept nodes?

You might be able to fix by simply changing EmpData to //EmpData
Aug 21 '07 #2
souravXML
1 New Member
What i have to do ,if i want some other contents in sheet2 i.e not a blank sheet
Thanks
Mar 20 '08 #3
jkmyoung
2,057 Recognized Expert Top Contributor
To answer your original question,

Create another <x:ExcelWorkshe et> node, and put your data in there.

Did you want one Worksheet per EmpNode?


My original response was off, sorry.
Mar 24 '08 #4
ritzkandy
1 New Member
What i have to do ,if i want some other contents in sheet2 i.e not a blank sheet
Thanks
SouravXML, just wanted to know if you were able to achieve contents in multiple excel worksheets. I have a similar requirement and wanted to know..

Thanks!
Sep 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
1780
by: LarryR | last post by:
The following XSLT works fine using MSXML 4.0 (e.g I receive a result in about 20 seconds), but effectively hangs in both .NET 1.0 sp2 with the XML hot fix and NET 1.1. My source XML file is large at over 46,000 <atl_client> nodes <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"...
3
2552
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: http://www.drpt.virginia.gov/temp1.gif All the fields on this form have validation controls on them so they can not submit the form unless all...
3
1446
by: darin dimitrov | last post by:
Hello, I have the following Html form: <form name="submitForProcess" action="http://localhost/xml/process.aspx" method="post" enctype="multipart/form-data"> <input type="text" name="customerId" value="5" /><br /> <input type="text" name="customerName" value="Johnson" /><br />
4
3186
by: Josh Behl | last post by:
When I try to programmatically open an existing Excel document using a custom windows form, it works perfectly. I instanciate a new instance of the Excel.ApplicationClass and then set the Visible property to 'true'...then I open the workbook in question via my code..... However, when I try this using ASP.NET. It does not work. I've...
11
5625
by: Not Me | last post by:
Hi, I'm trying to export from a gridview control, to an excel file using code intended for a datagrid control (it's all over the web, can post if requested) I get the error. Control 'gvSearch' of type 'GridView' must be placed inside a form tag with runat=server.
0
955
by: Wesley | last post by:
Hi, I'm creating a report in Excel using asp.net, but I can't release the Excel instance from memory. Excel.exe stays in the Windows Task Manager. Below is an example of the code I'm using: Dim appExcel As New Microsoft.Office.Interop.Excel.Application appExcel.ActiveWorkbook.Close() appExcel.Quit()
2
4218
by: Sasquatch | last post by:
I'm having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight forward, but it won't work for me. Here's what I did. 1. Created a new folder named "testlogin" 2. Turned that folder into an application using the IIS...
5
2297
by: Rajesh | last post by:
Hi, Please help me to do an EXCEL report generation using ASP.NET. I am building an website. This should work in all machine. I need do load the data from SQL tables to excel sheet and user can modify the data in the excel sheet. Then i need to get the data from modified excel sheet and generate the graphical Chart. But the machine need...
1
1531
by: micawber | last post by:
I would like to search and find records from Excel using ASP. Here is what I have so far, Can anyone help me? Thanks. <% Option Explicit Dim strConnection, conn, rs, strSQL, freephone
4
15402
by: =?Utf-8?B?Sm9zaW4gSm9obg==?= | last post by:
I could create MS Excel sheet using ASP.NET 2.0 with C# but it is not being created in some systems, following error occurs when the program compiles : Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. • To make more memory available, close workbooks or programs...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.