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的时候,我们需要读 ......
function getkeyvalue(s_keyname,s_keystr)
s_keybegin="<"+s_keyname+">"
s_keyend="</"+s_keyname+">"
s_i_begin=instr(s_keystr,s_keybegin)
s_i_end=instr(s_keystr,s_keyend)
if s_i_end<=s_i_begin+len(s_keybegin) then
getkeyvalue=""
exit function
else
getkeyvalue=mid(s_k ......
下载 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 ......
这篇文章被转载的次数最多,其实代码简陋得我自己都看不下去。只不过发表这篇文章时很多人需要这个功能。
这几天写个数据库查询分析器,要用到XML记录用户注册的数据库连接地址、端口等信息,最开始想用java ......