得到radiobuttonlist 选中值:
var CheckBoxList=document.all.optButtonList; 
            var objCheckBox,CheckValue="";
            for(i=0;i<CheckBoxList.rows.length;i++)   
            {   
                 objCheckBox   =    document.getElementById('optButtonList'+ "_"   +    i); 
                  if(objCheckBox.checked == true)
                   {
                                              CheckValue = objCheckBox.value;   
                   }
            }
            if(CheckValue!="")
            {
                alert(CheckValue)  ;          }
           
得到 CheckBoxList 选中值
 var CheckBoxList=document.all.checkList; 
            var objCheckBox,CheckValue="";
            for(i=0;i<CheckBoxList.rows.length;i++)   
            {   
                 objCheckBox   =    document.getElementById("checkList_"   +    i); 
                  if(objCheckBox.checked == true)
                   {
                         CheckValue += CheckBoxList.rows[i].cells[0].childNodes(1).innerText + ",";   
                   }
            }
            if(CheckValue!="")
            {
                  alert(CheckValue);                
            }
posted @ 2009-09-27 18:47 若心似海 阅读(105) | 评论(0) |  编辑

2009年9月17日 #

要用到数据导出到Excel的方法,四处搜索,发现竹林bat800在CSDN上的这个文字比较全面,记录在这里。
这是转载地址
这是作者的原文,Excel写成了Execl)
一、asp.net中导出Execl的方法:

在asp.net中导出Execl有两种方法,一种是将导出的文件存放在服务器某个文件夹下面,然后将文件地址输出在浏览器上;一种是将文件直接将文件输出流写给浏览器。在Response输出时,t分隔的数据,导出execl时,等价于分列,n等价于换行。 
1、将整个html全部输出execl

此法将html中所有的内容,如按钮,表格,图片等全部输出到Execl中。

   Response.Clear();     
   Response.Buffer=   true;     
   Response.AppendHeader("Content-Disposition","attachment;filename="+DateTime.Now.ToString("yyyyMMdd")+".xls");           
   Response.ContentEncoding=System.Text.Encoding.UTF8;   
   Response.ContentType   =   "application/vnd.ms-excel";   
   this.EnableViewState   =   false;   
这里我们利用了ContentType属性,它默认的属性为text/html,这时将输出为超文本,即我们常见的网页格式到客户端,如果改为ms-excel将将输出excel格式,也就是说以电子表格的格式输出到客户端,这时浏览器将提示你下载保存。ContentType的属性还包括:image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword 。同理,我们也可以输出(导出)图片、word文档等。下面的方法,也均用了这个属性。

2、将DataGrid控件中的数据导出Execl

上述方法虽然实现了导出的功能,但同时把按钮、分页框等html中的所有输出信息导了进去。而我们一般要导出的是数据,DataGrid控件上的数据。

System.Web.UI.Control ctl=this.DataGrid1;
//DataGrid1 是你在窗体中拖放的控件
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=Excel.xls"); 
HttpContext.Current.Response.Charset ="UTF-8";     
HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.Default; 
HttpContext.Current.Response.ContentType ="application/ms-excel";
ctl.Page.EnableViewState =false;    
System.IO.StringWriter  tw = new System.IO.StringWriter() ; 
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw); 
ctl.RenderControl(hw); 
HttpContext.Current.Response.Write(tw.ToString()); 
HttpContext.Current.Response.End();
如果你的DataGrid用了分页,它导出的是当前页的信息,也就是它导出的是DataGrid中显示的信息。而不是你select语句的全部信息。

为方便使用,写成方法如下:

public void DGToExcel(System.Web.UI.Control ctl)   
  { 
   HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=Excel.xls"); 
   HttpContext.Current.Response.Charset ="UTF-8";     
   HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.Default; 
   HttpContext.Current.Response.ContentType ="application/ms-excel";
   ctl.Page.EnableViewState =false;    
   System.IO.StringWriter  tw = new System.IO.StringWriter() ; 
   System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw); 
   ctl.RenderControl(hw); 
   HttpContext.Current.Response.Write(tw.ToString()); 
   HttpContext.Current.Response.End(); 
  } 
   用法:DGToExcel(datagrid1);
   
3、将DataSet中的数据导出Execl

有了上边的思路,就是将在导出的信息,输出(Response)客户端,这样就可以导出了。那么把DataSet中的数据导出,也就是把DataSet中的表中的各行信息,以ms-excel的格式Response到 http流,这样就OK了。说明:参数ds应为填充有数据表的DataSet,文件名是全名,包括后缀名,如execl2006.xls

public  void CreateExcel(DataSet ds,string FileName)  

 HttpResponse resp; 
 resp = Page.Response; 
 resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); 
 resp.AppendHeader("Content-Disposition", "attachment;filename="+FileName);    
 string colHeaders= "", ls_item="";   
 
 //定义表对象行对象,同时用DataSet对其值进行初始化 
 DataTable dt=ds.Tables[0]; 
 DataRow[] myRow=dt.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的
        int i=0; 
        int cl=dt.Columns.Count; 
    
 //取得数据表各列标题,各标题之间以t分割,最后一个列标题后加回车符 
 for(i=0;i  {
 if(i==(cl-1))//最后一列,加n
 {
 colHeaders +=dt.Columns[i].Caption.ToString() +"n"; 
 }
 else
 {
 colHeaders+=dt.Columns[i].Caption.ToString()+"t"; 
 }
       
 }
 resp.Write(colHeaders); 
 //向HTTP输出流中写入取得的数据信息 
   
 //逐行处理数据   
 foreach(DataRow row in myRow) 
 {     
 //当前行数据写入HTTP输出流,并且置空ls_item以便下行数据     
 for(i=0;i  {
 if(i== (cl-1))//最后一列,加n
 {
 ls_item +=row[i].ToString()+"n"; 
 }
 else
 {
 ls_item+=row[i].ToString()+"t"; 
 }
  
 }
 resp.Write(ls_item); 
 ls_item=""; 
    
 }    
 resp.End();  
 }
4、将dataview导出execl 
若想实现更加富于变化或者行列不规则的execl导出时,可用本法。
public void OutputExcel(DataView dv,string str) 

   //dv为要输出到Excel的数据,str为标题名称 
   GC.Collect(); 
   Application excel;// = new Application(); 
   int rowIndex=4; 
   int colIndex=1; 
 
   _Workbook xBk; 
   _Worksheet xSt; 
 
   excel= new ApplicationClass(); 
   
   xBk = excel.Workbooks.Add(true); 
    
   xSt = (_Worksheet)xBk.ActiveSheet; 
 
   // 
   //取得标题 
   // 
   foreach(DataColumn col in dv.Table.Columns) 
   { 
    colIndex++; 
    excel.Cells[4,colIndex] = col.ColumnName; 
    xSt.get_Range(excel.Cells[4,colIndex],excel.Cells[4,colIndex]).HorizontalAlignment = XlVAlign.xlVAlignCenter;//设置标题格式为居中对齐 
   } 
 
   // 
   //取得表格中的数据 
   // 
   foreach(DataRowView row in dv) 
   { 
    rowIndex ++; 
    colIndex = 1; 
    foreach(DataColumn col in dv.Table.Columns) 
    { 
     colIndex ++; 
     if(col.DataType == System.Type.GetType("System.DateTime")) 
     { 
      excel.Cells[rowIndex,colIndex] = (Convert.ToDateTime(row[col.ColumnName].ToString())).ToString("yyyy-MM-dd"); 
      xSt.get_Range(excel.Cells[rowIndex,colIndex],excel.Cells[rowIndex,colIndex]).HorizontalAlignment = XlVAlign.xlVAlignCenter;//设置日期型的字段格式为居中对齐 
     } 
     else 
      if(col.DataType == System.Type.GetType("System.String")) 
     { 
      excel.Cells[rowIndex,colIndex] = "'"+row[col.ColumnName].ToString(); 
      xSt.get_Range(excel.Cells[rowIndex,colIndex],excel.Cells[rowIndex,colIndex]).HorizontalAlignment = XlVAlign.xlVAlignCenter;//设置字符型的字段格式为居中对齐 
     } 
     else 
     { 
      excel.Cells[rowIndex,colIndex] = row[col.ColumnName].ToString(); 
     } 
    } 
   } 
   // 
   //加载一个合计行 
   // 
   int rowSum = rowIndex + 1; 
   int colSum = 2; 
   excel.Cells[rowSum,2] = "合计"; 
   xSt.get_Range(excel.Cells[rowSum,2],excel.Cells[rowSum,2]).HorizontalAlignment = XlHAlign.xlHAlignCenter; 
   // 
   //设置选中的部分的颜色 
   // 
   xSt.get_Range(excel.Cells[rowSum,colSum],excel.Cells[rowSum,colIndex]).Select(); 
   xSt.get_Range(excel.Cells[rowSum,colSum],excel.Cells[rowSum,colIndex]).Interior.ColorIndex = 19;//设置为浅黄色,共计有56种 
   // 
   //取得整个报表的标题 
   // 
   excel.Cells[2,2] = str; 
   // 
   //设置整个报表的标题格式 
   // 
   xSt.get_Range(excel.Cells[2,2],excel.Cells[2,2]).Font.Bold = true; 
   xSt.get_Range(excel.Cells[2,2],excel.Cells[2,2]).Font.Size = 22; 
   // 
   //设置报表表格为最适应宽度 
   // 
   xSt.get_Range(excel.Cells[4,2],excel.Cells[rowSum,colIndex]).Select(); 
   xSt.get_Range(excel.Cells[4,2],excel.Cells[rowSum,colIndex]).Columns.AutoFit(); 
   // 
   //设置整个报表的标题为跨列居中 
   // 
   xSt.get_Range(excel.Cells[2,2],excel.Cells[2,colIndex]).Select(); 
   xSt.get_Range(excel.Cells[2,2],excel.Cells[2,colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenterAcrossSelection; 
   // 
   //绘制边框 
   // 
   xSt.get_Range(excel.Cells[4,2],excel.Cells[rowSum,colIndex]).Borders.LineStyle = 1; 
   xSt.get_Range(excel.Cells[4,2],excel.Cells[rowSum,2]).Borders[XlBordersIndex.xlEdgeLeft].Weight = XlBorderWeight.xlThick;//设置左边线加粗 
   xSt.get_Range(excel.Cells[4,2],excel.Cells[4,colIndex]).Borders[XlBordersIndex.xlEdgeTop].Weight = XlBorderWeight.xlThick;//设置上边线加粗 
   xSt.get_Range(excel.Cells[4,colIndex],excel.Cells[rowSum,colIndex]).Borders[XlBordersIndex.xlEdgeRight].Weight = XlBorderWeight.xlThick;//设置右边线加粗 
   xSt.get_Range(excel.Cells[rowSum,2],excel.Cells[rowSum,colIndex]).Borders[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlThick;//设置下边线加粗 
   // 
   //显示效果 
   // 
   excel.Visible=true; 
 
   //xSt.Export(Server.MapPath(".")+""+this.xlfile.Text+".xls",SheetExportActionEnum.ssExportActionNone,Microsoft.Office.Interop.OWC.SheetExportFormat.ssExportHTML); 
   xBk.SaveCopyAs(Server.MapPath(".")+""+this.xlfile.Text+".xls"); 
 
   ds = null; 
            xBk.Close(false, null,null); 
    
            excel.Quit(); 
            System.Runtime.InteropServices.Marshal.ReleaseComObject(xBk); 
            System.Runtime.InteropServices.Marshal.ReleaseComObject(excel); 
    System.Runtime.InteropServices.Marshal.ReleaseComObject(xSt); 
            xBk = null; 
            excel = null; 
   xSt = null; 
            GC.Collect(); 
   string path = Server.MapPath(this.xlfile.Text+".xls"); 
 
   System.IO.FileInfo file = new System.IO.FileInfo(path); 
   Response.Clear(); 
   Response.Charset="GB2312"; 
   Response.ContentEncoding=System.Text.Encoding.UTF8; 
   // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 
   Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name)); 
   // 添加头信息,指定文件大小,让浏览器能够显示下载进度 
   Response.AddHeader("Content-Length", file.Length.ToString()); 
    
   // 指定返回的是一个不能被客户端读取的流,必须被下载 
   Response.ContentType = "application/ms-excel"; 
    
   // 把文件流发送到客户端 
   Response.WriteFile(file.FullName); 
   // 停止页面的执行 
   
   Response.End(); 
}
   
   上面的方面,均将要导出的execl数据,直接给浏览器输出文件流,下面的方法是首先将其存到服务器的某个文件夹中,然后把文件发送到客户端。这样可以持久的把导出的文件存起来,以便实现其它功能。 
5、将execl文件导出到服务器上,再下载。

二、winForm中导出 Execl的方法:

1、方法1:

   SqlConnection conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["conn"]); 
   SqlDataAdapter da=new SqlDataAdapter("select * from tb1",conn); 
   DataSet ds=new DataSet(); 
   da.Fill(ds,"table1"); 
   DataTable dt=ds.Tables["table1"]; 
   string name=System.Configuration.ConfigurationSettings.AppSettings["downloadurl"].ToString()+DateTime.Today.ToString("yyyyMMdd")+new Random(DateTime.Now.Millisecond).Next(10000).ToString()+".csv";//存放到 web.config中downloadurl指定的路径,文件格式为当前日期+4位随机数 
   FileStream fs=new FileStream(name,FileMode.Create,FileAccess.Write); 
   StreamWriter sw=new StreamWriter(fs,System.Text.Encoding.GetEncoding("gb2312")); 
   sw.WriteLine(" 自动编号,姓名,年龄"); 
   foreach(DataRow dr in dt.Rows) 
   { 
    sw.WriteLine(dr["ID"]+","+dr["vName"]+","+dr["iAge"]); 
   } 
   sw.Close(); 
   Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(name)); 
   Response.ContentType = "application/ms-excel";// 指定返回的是一个不能被客户端读取的流,必须被下载 
   Response.WriteFile(name); // 把文件流发送到客户端 
   Response.End();
 
public void Out2Excel(string sTableName,string url)
{
Excel.Application oExcel=new Excel.Application();
Workbooks oBooks;
Workbook oBook;
Sheets oSheets;
Worksheet oSheet;
Range oCells;
string sFile="",sTemplate="";
//
System.Data.DataTable dt=TableOut(sTableName).Tables[0];

sFile=url+"myExcel.xls";
sTemplate=url+"MyTemplate.xls";
//
oExcel.Visible=false;
oExcel.DisplayAlerts=false;
// 定义一个新的工作簿
oBooks=oExcel.Workbooks;
oBooks.Open(sTemplate,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing, Type.Missing, Type.Missing);
oBook=oBooks.get_Item(1);
oSheets=oBook.Worksheets;
oSheet=(Worksheet)oSheets.get_Item(1);
// 命名该sheet
oSheet.Name="Sheet1";

oCells=oSheet.Cells;
//调用 dumpdata过程,将数据导入到Excel中去
DumpData(dt,oCells);
//保存
oSheet.SaveAs(sFile,Excel.XlFileFormat.xlTemplate,Type.Missing,Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing);
oBook.Close(false, Type.Missing,Type.Missing);
//退出Excel,并且释放调用的COM资源
oExcel.Quit();

GC.Collect();
KillProcess("Excel");
}

private void KillProcess(string processName)
{
System.Diagnostics.Process myproc= new System.Diagnostics.Process();
//得到所有打开的进程
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
if(!thisproc.CloseMainWindow())
{
thisproc.Kill();
}
}
}
catch(Exception Exc)
{
throw new Exception("",Exc);
}
}

2、方法2:

protected void ExportExcel()
  {
   gridbind(); 
   if(ds1==null) return; 
  
   string saveFileName="";
//   bool fileSaved=false;
   SaveFileDialog saveDialog=new SaveFileDialog();
   saveDialog.DefaultExt ="xls";
   saveDialog.Filter="Excel文件|*.xls";
   saveDialog.FileName ="Sheet1";
   saveDialog.ShowDialog();
   saveFileName=saveDialog.FileName;
   if(saveFileName.IndexOf(":")<0) return; //被点了取消
//   excelapp.Workbooks.Open   (App.path & 工程进度表.xls) 
   
   Excel.Application xlApp=new Excel.Application();
   object missing=System.Reflection.Missing.Value;

if(xlApp==null)
   {
    MessageBox.Show(" 无法创建Excel对象,可能您的机子未安装Excel");
    return;
   }
   Excel.Workbooks workbooks=xlApp.Workbooks;
   Excel.Workbook workbook=workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
   Excel.Worksheet worksheet=(Excel.Worksheet)workbook.Worksheets[1];//取得sheet1
   Excel.Range range;
    
  
   string oldCaption=Title_label .Text.Trim ();
   long totalCount=ds1.Tables[0].Rows.Count;
   long rowRead=0;
   float percent=0; 
  
   worksheet.Cells[1,1]=Title_label .Text.Trim ();
   // 写入字段
   for(int i=0;i    {
    worksheet.Cells[2,i+1]=ds1.Tables[0].Columns.ColumnName;  
    range=(Excel.Range)worksheet.Cells[2,i+1];
    range.Interior.ColorIndex = 15;
    range.Font.Bold = true;
  
   }
   //写入数值
   Caption .Visible = true;
   for(int r=0;r    {
    for(int i=0;i     {
     worksheet.Cells[r+3,i+1]=ds1.Tables[0].Rows[r];     
    }
    rowRead++;
    percent=((float)(100*rowRead))/totalCount;    
    this.Caption.Text= "正在导出数据["+ percent.ToString("0.00")  +"%]...";
    Application.DoEvents();
   }
   worksheet.SaveAs(saveFileName,missing,missing,missing,missing,missing,missing,missing,missing);
   
   this.Caption.Visible= false;
   this.Caption.Text= oldCaption; 
  
   range=worksheet.get_Range(worksheet.Cells[2,1],worksheet.Cells[ds1.Tables[0].Rows.Count+2,ds1.Tables[0].Columns.Count]);
   range.BorderAround(Excel.XlLineStyle.xlContinuous,Excel.XlBorderWeight.xlThin,Excel.XlColorIndex.xlColorIndexAutomatic,null);
   
   range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic;
   range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle =Excel.XlLineStyle.xlContinuous;
   range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].Weight =Excel.XlBorderWeight.xlThin; 
  
   if(ds1.Tables[0].Columns.Count>1)
   {
    range.Borders[Excel.XlBordersIndex.xlInsideVertical].ColorIndex=Excel.XlColorIndex.xlColorIndexAutomatic;
    }
   workbook.Close(missing,missing,missing);
   xlApp.Quit();
  }

三、附注: 
虽然都是实现导出execl的功能,但在asp.net和winform的程序中,实现的代码是各不相同的。在asp.net中,是在服务器端读取数据,在服务器端把数据以ms-execl的格式,以Response输出到浏览器(客户端);而在winform中,是把数据读到客户端(因为 winform运行端就是客户端),然后调用客户端安装的office组件,将读到的数据写在execl的工作簿中。
posted @ 2009-09-17 17:51 若心似海 阅读(58) | 评论(0) |  编辑

2009年9月3日 #

1. 使字母,数字,汉字 等字体统一,要设置成 
font-size: 12px; (一般都是使用12px)
font-family: arial;

(以后会继续补充相关知识)

posted @ 2009-09-03 13:54 若心似海 阅读(90) | 评论(2) |  编辑

2009年9月1日 #

今天写了一个小程序,就是将ppt转换成html,怕以后忘记,在此记录一下,也和大家分享
源码如下:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using PPT = Microsoft.Office.Interop.PowerPoint;
using System.Reflection;

namespace WritePptDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            string path;         //文件路径变量

PPT.Application pptApp;     //Excel应用程序变量
            PPT.Presentation pptDoc;     //Excel文档变量

PPT.Presentation pptDoctmp;

path = @"C:\MyPPT.ppt";      //路径
            pptApp = new PPT.ApplicationClass();   //初始化

//如果已存在,则删除
            if (File.Exists((string)path))
            {
                File.Delete((string)path);
            }

//由于使用的是COM库,因此有许多变量需要用Nothing代替
            Object Nothing = Missing.Value;
            pptDoc = pptApp.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse);
            pptDoc.Slides.Add(1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutText);

string text = "示例文本";

foreach (PPT.Slide slide in pptDoc.Slides)
            {
                foreach (PPT.Shape shape in slide.Shapes)
                {
                    shape.TextFrame.TextRange.InsertAfter(text);
                }
            }

//WdSaveFormat为Excel文档的保存格式
            PPT.PpSaveAsFileType format = PPT.PpSaveAsFileType.ppSaveAsDefault;

//将excelDoc文档对象的内容保存为XLSX文档 
            pptDoc.SaveAs(path, format, Microsoft.Office.Core.MsoTriState.msoFalse);

//关闭excelDoc文档对象 
            pptDoc.Close();

//关闭excelApp组件对象 
            pptApp.Quit();

Console.WriteLine(path + " 创建完毕!");

Console.ReadLine();

string pathHtml = @"c:\MyPPT.html";

PPT.Application pa = new PPT.ApplicationClass();

pptDoctmp = pa.Presentations.Open(path, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse);
            PPT.PpSaveAsFileType formatTmp = PPT.PpSaveAsFileType.ppSaveAsHTML;
            pptDoctmp.SaveAs(pathHtml, formatTmp, Microsoft.Office.Core.MsoTriState.msoFalse);
            pptDoctmp.Close();
            pa.Quit();
            Console.WriteLine(pathHtml + " 创建完毕!");
        }
    }
}

以上程序是使用C# 先创建一个ppt 文件并向里面写入了文字,然后再把此ppt 转换成html  ,对于上面程序需要说明的其实就是
引用 dll的问题, 在项目中添加引用,在com 组件中选择 microsoft powerpoint 11.0 object library ,而如果你的电脑没有安装 office 2003 是不会有这个的,而如果安装的是office 2007 则是microsoft powerpoint 12.0 object library。而且即使你引用成功后,还是会编译不通过,是因为少安装了 office PIA  ,在安装office 时,如果你是选择的典型安装是不会安装这个的,因为这个只针对开发人员才会用到。可以到网上下载一个 office PIA 安装下就ok了。

 
 

C#中的文件导出大全的更多相关文章

  1. PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型),把Comment写到name中,pdm文件导出为word

    PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型) 环境:powderdesigner12.5:mysql5.0步骤:1. 为指定的数据库配置mysql的ODBC数据源先下载 ...

  2. Vue项目中的文件导出

    项目中涉及到文件导出,分xml和excel导出.不同的文件导出格式不同,需要根据文件类型判断导出格式. exportAllData(val){ //全部导出 if(!val){ this.export ...

  3. Linux中shell文件操作大全

    1.创建文件夹#!/bin/shmkdir -m 777 "%%1" 2.创建文件#!/bin/shtouch "%%1" 3.删除文件#!/bin/shrm ...

  4. asp.net导出excel-一行代码实现excel、xml、pdf、word、html、csv等7种格式文件导出功能而且美观-SNF快速开发平台

    分享: 腾讯微博  新浪微博   搜狐微博   网易微博  腾讯朋友  百度贴吧  豆瓣   QQ好友  人人网 作者:王春天  原文地址:http://www.cnblogs.com/spring_ ...

  5. Qt中将QTableView中的数据导出为Excel文件

    如果你在做一个报表类的程序,可能将内容导出为Excel文件是一项必须的功能.之前使用MFC的时候我就写过一个类,用于将grid中的数据导出为Excel文件.在使用了QtSql模块后,我很容易的将这个类 ...

  6. MySQL数据库中.SQL文件的导出方式

    转自:http://tech.watchstor.com/management-117401.htm 在MySQL数据库中导入SQL文件是件很麻烦的事情,但是这是一项大家非常值得学习的技术,本文就从最 ...

  7. 将ACCESS 的数据库中的表的文件 导出了EXCEL格式

    将ACCESS 的数据库中的表的文件 导出了EXCEL格式 '''' '将ACCESS数据库中的某个表的信息 导出为EXCEL 文件格式 'srcfName ACCESS 数据库文件路径 'desfN ...

  8. 网页中Office和pdf相关文件导出

    最近被派去维护和开发一些做了一半.年久失修的项目.有一部分内容是关于word文件导出,顺带着把excel.pdf文件的导出也调研下吧,我想未来开发我应该会遇到的,遂做了下笔记分享给需要的人. 由于项目 ...

  9. (转载)SQL语句导入导出大全

    SQL语句导入导出大全 /******* 导出到excel EXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:\temp1.xls -c ...

随机推荐

  1. SDK_组合框的使用

    组合框的使用 组合框的创建:有三种风格,分别 Simaple,Dropdown(可输入), 下拉列表(不可输入) 可以通过可视化编程中下拉列表的 下拉箭头 设置列表的长度 如何向组合框控件中添加数据, ...

  2. day21-2 类的派生

    目录 类的派生 派生方法一 派生方法二 类的派生 派生:子类中新定义属性的这个过程叫做派生 派生方法一 指明道姓访问某一个类的函数:该方法与继承无关 class People: def __init_ ...

  3. 并发和多线程(二)--线程安全、synchronized、CAS简介

    线程安全性: 当多个线程访问一个类的时候,这个类始终表示出正确的行为,那么这个类是线程安全的. 无状态的对象一定是线程安全的,例如大部分service.dao.Servlet都是无状态的. 线程安全体 ...

  4. Python基础之字符的编码

    参考原文 Python廖雪峰 为什么要进行编码? 计算机只能处理二进制数字(0100111),要处理文本,就必须先把文本转为数字才能处理,这个过程就叫编码. 字符的编码 ASCII编码 由于计算机是美 ...

  5. 「 HDU P3336 」 Count the string

    题目大意 给出一个长度为 $n$ 的字符串 $s$ 要求你求出 $s$ 的每一个前缀在 $s$ 中出现的次数之和.$n\le 200000$. 解题思路 暴力的对每一个前缀进行一次匹配,求出出现次数后 ...

  6. 魂酥的LNOI2019滚粗记

    $Day -???$ 高一下终于开始了 在开学文化课考试的水题之下混了个(成绩)前排 于是我便油然而生一种自信 我!要!进!省!队! 讲句真话我这么想的时候连自己都觉得自己是个十足的沙雕 我又不是zw ...

  7. linux tail-在屏幕上显示指定文件的末尾若干行

    博主推荐:获取更多 linux文件内容查看命令 收藏:linux命令大全 tail命令用于输入文件中的尾部内容.tail命令默认在屏幕上显示指定文件的末尾10行.如果给定的文件不止一个,则在显示的每个 ...

  8. AD7606

    在只给芯片的RANGE和PAR_SER引脚上电(不给芯片加电)的时候,芯片严重发热. 改回给芯片加电,发热消失,芯片正常工作,芯片没有损坏. 版权声明:本文为博主原创文章,未经博主允许不得转载.

  9. 关于zookeeper和zkfc的一些测试

    1.停掉zookeeper集群 ****进程影响****** zkfc:报错无法连接zookeeper.ClientCnxn java.net.connectexception:拒绝连接,但不会shu ...

  10. Leetcode 122.买卖股票的最佳时机II

    给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格. 设计一个算法来计算你所能获取的最大利润.你可以尽可能地完成更多的交易(多次买卖一支股票). 注意:你不能同时参与多笔交易(你必须在再次 ...