C# 获取文件信息并导出Excel,Xml报表
using System;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
// 添加引用 -> .NET -> Microsoft.Office.Interop.Excel(2003->11.0, 2007->12.0)
namespace WinFormTable
{
public partial class FormTable : Form
{
#region
private DataTable table;
private ChineseLunisolarCalendar lunarCalendar;
#endregion
public FormTable()
{
#region
InitializeComponent();
lunarCalendar = new ChineseLunisolarCalendar(); // 中国阴历。
table = new DataTable("File");
table.Locale = CultureInfo.InvariantCulture; // 固定区域。
DataColumn column = table.Columns.Add("Name", typeof(String));
table.Columns.Add("Length", typeof(Decimal));
table.Columns.Add("CreationTime", typeof(DateTime));
table.Constraints.Add("PK", column, true); // 创建主键。
table.DefaultView.ApplyDefaultSort = true; // 使用默认排序。
GridViewStyle();
&nbs
相关文档:
SAX概念
SAX是Simple API for XML的缩写,它并不是由W3C官方所提出的标准,可以说是“民间”的事实标准。实际上,它是一种社区性质的讨论产物。虽然如此,在XML中对SAX的应用丝毫不比DOM少,几乎所有的XML解析器都会支持它。
与DOM比较而言,SAX是一种轻量型的方法。我们知道,在处理DOM的时候,我们需要读 ......
得到一个需要处理的XMl
private string GetSaveItem()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<menuCollection/>");
foreach (TreeNode node in trvAccessRight.CheckedNodes)
{
if (node != trvAccess ......
下载 dom4j-1.6.1.jar。
1: package org.zzp.common.xml.dom4j;
2:
3: import java.io.FileWriter;
4: import java.io.IOException;
5: import org.dom4j.Document;
6: import org.dom4j.DocumentHelper;
7: import org.dom4j.Element;
8: import org.dom4j.io.OutputFormat;
9: impor ......
Introduction to XML and XML With Java
If you are looking for sample programs to parse a XML file using DOM/SAX parser or looking for a program to generate a XML file please proceed directly to programs.
This small tutorial introduces you to the basic concepts of XML and using Xer ......
在很多情况下, 我们会用到XML,比如说配置文件等.C#提供了XML类.
这里我只是简单的写一下XML文件的生成,解析就不多说了.
第一种方法
DataBase db = DataBaseFactory.CreateDataBase(DataBaseType.MySql, strMysql);
......