You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
6.0 KiB
138 lines
6.0 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML xmlns:MSHelp="http://msdn.microsoft.com/mshelp" DIR="LTR"><HEAD>
|
|
<meta name="GENERATOR" content="VBdocman .NET - documentation generator; http://www.vbdocman.com">
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=UTF-8">
|
|
<TITLE>frmAuswertung.DatatableToExcel -Methode</TITLE>
|
|
<xml>
|
|
<MSHelp:TOCTitle Title="frmAuswertung.DatatableToExcel -Methode"/>
|
|
<MSHelp:RLTitle Title="frmAuswertung.DatatableToExcel -Methode"/>
|
|
<MSHelp:Keyword Index="A" Term="topic_0000000000000482"/>
|
|
<MSHelp:Keyword Index="K" Term="frmAuswertung.DatatableToExcel -Methode"/>
|
|
<MSHelp:Keyword Index="K" Term="Vertragsverwaltung.frmAuswertung.DatatableToExcel -Methode"/>
|
|
<MSHelp:Keyword Index="F" Term="Vertragsverwaltung.frmAuswertung.DatatableToExcel"/>
|
|
<MSHelp:Keyword Index="F" Term="frmAuswertung.DatatableToExcel"/>
|
|
<MSHelp:Keyword Index="F" Term="Vertragsverwaltung.frmAuswertung.frmAuswertung.DatatableToExcel"/>
|
|
<MSHelp:Attr Name="DevLang" Value="VB"/>
|
|
<MSHelp:Attr Name="DevLangVers" Value="kbLangVB"/>
|
|
<MSHelp:Attr Name="DocSet" Value="Visual Basic"/>
|
|
<MSHelp:Attr Name="DocSet" Value="Visual Studio"/>
|
|
<MSHelp:Attr Name="DocSet" Value="VSM"/>
|
|
<MSHelp:Attr Name="Product" Value="VB"/>
|
|
<MSHelp:Attr Name="ProductVers" Value="kbVBp700"/>
|
|
<MSHelp:Attr Name="Product" Value="VSA"/>
|
|
<MSHelp:Attr Name="ProductVers" Value="kbVSA"/>
|
|
<MSHelp:Attr Name="Technology" Value="ManagedCode"/>
|
|
<MSHelp:Attr Name="TechnologyVers" Value="kbManagedCode"/>
|
|
<MSHelp:Attr Name="TopicType" Value="kbSyntax"/>
|
|
<MSHelp:Attr Name="TargetOS" Value="Windows"/>
|
|
<MSHelp:Attr Name="Locale" Value="kbEnglish"/>
|
|
</xml>
|
|
<META name="rtfFileName" content="">
|
|
<META NAME="save" CONTENT="history">
|
|
<!--CSS_START-->
|
|
<SCRIPT SRC="MSHelp/scripts/dtuelink.js"></SCRIPT>
|
|
<!--CSS_END-->
|
|
<SCRIPT language="JavaScript">
|
|
function indent(level) {
|
|
for (i=1; i<=level; i++) {
|
|
document.write(" ");
|
|
}
|
|
}
|
|
</SCRIPT>
|
|
</HEAD>
|
|
<body topmargin=0 id="bodyID" class = "dtBODY"><!--NONSCROLLING BANNER START-->
|
|
<div id="nsbanner">
|
|
<div id="bannerrow1">
|
|
<TABLE CLASS="bannerparthead" CELLSPACING=0>
|
|
<TR ID="hdr">
|
|
<TD CLASS="runninghead" nowrap>Vertragsverwaltung-Klassenbibliothek</TD>
|
|
<TD CLASS="product" nowrap> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</div>
|
|
<div id="TitleRow">
|
|
<H1 class="dtH1"><A NAME="topic_0000000000000482"></A>frmAuswertung.DatatableToExcel -Methode</H1>
|
|
</div></div>
|
|
<!--NONSCROLLING BANNER END-->
|
|
|
|
<DIV id="nstext" valign="bottom"><!---->
|
|
|
|
|
|
|
|
|
|
|
|
<PRE class="syntax"><SPAN class="lang">[Visual Basic]
|
|
</SPAN><B>Public Shared Function DatatableToExcel( _ <br> ByVal <i>aDataTable</i> As <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemDataDataTableClassTopic.htm">DataTable</a>, _ <br> ByVal <i>aOutputFilename</i> As <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemStringClassTopic.htm">String</a> _ <br>) As <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemBooleanClassTopic.htm">Boolean</a></B></PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<H4 class="dtH4">Parameter</H4>
|
|
<dl>
|
|
<dt><i>aDataTable</i></dt>
|
|
<dd></dd>
|
|
<dt><i>aOutputFilename</i></dt>
|
|
<dd></dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<H4 class="dtH4">Quellcode</H4>
|
|
<pre class="code"><SPAN class="lang">[Visual Basic]</SPAN>
|
|
Public Shared Function DatatableToExcel(ByVal aDataTable As DataTable, ByVal aOutputFilename As String) As Boolean <br> Application.DoEvents() <br> Dim f As New FrmExcelExport <br> Dim app As New Object <br> Dim wb As New Object <br> Dim ws As New Object <br> Try <br> f.Show() <br> Application.DoEvents() <br> f.ProgressBar1.Minimum = 0 <br> f.ProgressBar1.Maximum = aDataTable.Rows.Count <br> app = CreateObject("Excel.application") <br> 'Dim wb As Object <br> 'Dim ws As Object <br> ' Dim app As New Excel.ApplicationClass <br> ' Dim wb As Excel.Workbook <br> ' Dim ws As Excel.Worksheet <br> wb = app.Workbooks.add() <br> 'wb = app.Workbooks.Add() <br> ws = wb.ActiveSheet() <br> Dim dc As DataColumn <br> Dim dr As DataRow <br> Dim colIndex As Integer <br> Dim rowIndex As Integer <br> ' Columns erstellen <br> For Each dc In aDataTable.Columns <br> colIndex += 1 <br> app.Cells(1, colIndex) = dc.ColumnName <br> Next <br> ' Rows hinzufügen <br> For Each dr In aDataTable.Rows <br> f.ProgressBar1.Value = rowIndex <br> rowIndex += 1 <br> colIndex = 0 <br> For Each dc In aDataTable.Columns <br> colIndex += 1 <br> app.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName) <br> Next <br> Next <br> ws.Columns.AutoFit() <br> wb.SaveAs(aOutputFilename) <br> app.Workbooks.Open(aOutputFilename) <br> ' Excel anzeigen wenn fertig exportiert <br> app.Visible = True <br> ws = Nothing <br> wb = Nothing <br> app = Nothing <br> <br> f.Close() <br> Return True <br> Catch ex As Exception <br> f.Close() <br> MsgBox(ex.Message) <br> End Try <br> <br> <br> End Function
|
|
</pre>
|
|
|
|
|
|
|
|
<H4 class="dtH4">Forderungen</H4>
|
|
<P><b class="le">Plattformen: </b>Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition</P>
|
|
|
|
|
|
<H4 class="dtH4">Siehe auch</H4>
|
|
<p>
|
|
<a href="topic_000000000000047C.html">frmAuswertung</a>
|
|
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<DIV CLASS="footer">
|
|
<HR>
|
|
Generated by VBdocman .NET
|
|
<p>
|
|
</div></div>
|
|
</BODY>
|
|
</HTML>
|
|
|