莘县生活网

 找回密码
 立即注册
查看: 430|回复: 0

另类方式生成Excel

[复制链接]

8211

主题

8211

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
25419
发表于 2015-9-12 18:05:58 | 显示全部楼层 |阅读模式
  sw.Close();

fs.Close();





sw.Write(filecontent);

StreamWriter sw = new StreamWriter(fs);

FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath(filename), FileMode.Create);

public static void CreateTxtFile(string filename, string filecontent)

return FileContent;

objStreamReader.Close();

string FileContent = objStreamReader.ReadToEnd();

StreamReader objStreamReader = File.OpenText(Server.MapPath(filename));

public string ReadTxtFile(string filename)

CreateTxtFile(filename, fc); //想知道创建文件

string filename = "xls/" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + ".xls"; //生成文件看着另类名

string fc = t + Label1.Text + d; //组合成全部内容

string d = ReadTxtFile("di.txt");//读入底文件内容

string t = ReadTxtFile("tou.txt"); //读入头文件内容

现在开始生成excel文件:

</table>

<![endif]>

</tr>

<td width=72 style='width:54pt'></td>

<td width=72 style='width:54pt'></td>

<td width=72 style='width:54pt'></td>

<td width=72 style='width:54pt'></td>

<tr height=0 style='display:none'>

<![if supportMisalignedColumns]>

collapse;table-layout:fixed;width:216pt'>

<table x:str border=0 cellpadding=0 cellspacing=0 width=288 style='border-collapse:

di.txthttp 文件内容如下:

<body link=blue vlink=purple>

</head>

</xml><![endif]-->

</x:ExcelWorkbook>

&www.11 lt;xrotectWindows>False</xrotectWindows>

<xrotectStructure>Fals你看e</xrotectStructure>

<x:WindowTopY>1395</x:WindowTopY>

<x:WindowTopX>0</x:WindowTopX>

<x:WindowWidth></x:WindowWidth>

<x:WindowHeight>6600</x:WindowHeight>

</x:ExcelWorksheets>

</x:ExcelWorksheet>

</x:Workshewww.222sc.sometOptions>

<xrotectScenarios>False</xrotectScenarios>

<xrotectObjects>False</xrotectObjects>

<xrotectContents>False</xrotectContents>

<xefaultRowHeight>225</xefaultRowHeight>

<x:WorksheetOptions>

学会<x:Name>Sheet3</x:Name>

<x:ExcelWorksheet>

</x:ExcelWorksheet>

</x:WorksheetOptions>

<x:ProtectScenarios>False</x:ProtectScenarios>

<x:ProtectObjects>False</x:ProtectObjects>

<x:ProtectContents>False</scaspx:ProtectContents>

<xefaultRowHeight>225</xefaultRowHeight>

<x:WorksheetOptions>

<x:Name>Sheet2</x:Name>

<x:ExcelWorksheet>

</x:ExcelWorksheet>

</x:WorksheetOptions>

<x:ProtectScenarios>False</x:ProtectScenarios>

其实生成<x:ProtectObjects>False</x:ProtectObjects>

<x:ProtectContents>False</x:ProtectContents>

</x:Panes>

</x:Pane>

<x:ActiveCol>5</x:ActiveCol>

<x:ActiveRow>24</x:ActiveRow>

<x:Number>3</x:Number>

<x:Pane>

<x:Panes>

<x:Selected/>

</x:Print>

<x:VerticalResolution>0</x:VerticalResolution>

<x:HorizontalResolution>-3</x:HorizontalResolution>

<x:PaperSizeIndex>9</x:PaperSizeIndex>

<x:ValidPrinterInfo/>

<x:Print>

<xefaultRowHeight>225</xefaultRowHeight>

<x:WorksheetOptions>

<x:Name>Sheet1</x:Name>

<x:ExcelWorksheet>

<x:ExcelWorksheets>

<x:ExcelWorkbook>

<!--[if gte mso 9]><xml>

</style>

-->

display:none;}

mso-char-type:none;

mso-font-charset:134;

mso-generic-font-family:auto;

font-family:宋体;

text-decoration:none;

font-style:normal;

font-weight:400;

font-size:9.0pt;

{color:windowtext;

{ruby-align:left;}

ruby

border:.5pt solid windowtext;}

text-align:left;

mso-number-format:"Long Date";

{mso-style-parent:style0;

.xl25

border:.5pt solid windowtext;}

{mso-style-parent:style0;

.xl24

mso-rotate:0;}

white-space:nowrap;

mso-protection:locked visible;

mso-pattern:auto;

mso-background-source:auto;

border:none;

vertical-align:bottom;

text-align:general;

mso-number-format:General;

mso-font-charset:134;

mso-generic-font-family:auto;

font-family:www.11 宋体;

text-decoration:none;

font-style:normal;

font-weight:400;

font-size:9.0pt;

color:windowtext;

mso-ignore:padding;

padding-left:1px;

padding-right:1px;

padding-top:1px;

{mso-style-parent:style0;

mso-style-id:0;}

mso-style-name:你知道www.11 常规;

mso-protection:locked visible;

border:none;

mso-font-charset:134;

mso-generic-font-family:auto;

font-family:宋体;

text-decoration:none;

font-style:normal;

font-weight:400;

font-size:9.0pt;

color:windowtext;

mso-pattern:auto;

mso-background-source:auto;

mso-rotate:0;

whexcelite-space:nowrap;

vertical-align:bottom;

text-align:general;

{mso-number-format:Gwwweneral;

.style0

{mso-data-placement:same-cell;}

mso-ruby-visibility:none;}

{mso-width-source:auto;

mso-ruby-visibility:none;}

{mso-height-source:auto;

mso-footer-margin:.5in;}

mso-header-margin:.5in;

{margin:1.0in .75in 1.0in .75in;

@page

mso-displayed-thousand-separator:"\,";}

{mso-displayed-decimal-separator:"\.";

<!--table

<stynet另类方式生成Excelle>

</xml><![endif]-->

</o:OfficeDocu其实netmentSettings>

<oocationOfComponents HRef=">

<oownloadComponents/>

<o:OfficeDocumentSettings>

</oocumentProperties>

<o:Version>9.2812</o:Version>

<o:Company>zydn</o:Company>

<oastSaved>2002-06-22T10:03:03Z</oastSaved>

<o:Created>2002-05-27T17:51:00Z</o:Created>

<oastAuthor>xky</oastAuthor>

<o:Author>xky</o:Author>

<oocumentProperties>

<!--[if gte mso 9]><xml>

<link rel=OLE-Object-Data href="./222.files/oledata.mso">

<link rel=Edit-Time-Data href="./222.files/editdata.mso">

<link rel=File-List href="./222.files/filelist.xml">

<meta name=Generator content="Microsoft Excel 9">

<meta name=ProgId content=Excel.Sheet>

<meta http-equiv=Content-Type content="text/html; charset=utf-8">

<head>

xmlns="">

xmlns:x="urn:schemas-microsoft-comffice:excel"

<html xmlns="urn:schemas-microsoft-comfficeffice"

tou.txt想知道http 文件内容如下:

首页,www.222sc.net。此方式仅生成纯文本文件,www.111scweb.com。当然,就是在不引用excel情况下生成excel文件,所谓另类,


net另类方式生成Excel
www.222sc
www
学习
我不知道
事实上www.222sc
看看www.11 222你知道
你看www.222sc
对于222scAsp
其实222scAsp
对比一下方式
http
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|申博娱乐 ( 晋icp备11001293号

GMT+8, 2018-8-15 09:28 , Processed in 0.147074 second(s), 21 queries .

Powered by 申博www.88msc.com

© 2006-2014 www.063508.com

快速回复 返回顶部 返回列表