
加好友 发短信
等级:四尾狐
帖子:902
积分:8300
威望:0
精华:0
注册:2012/10/19 13:55:00
|
在打开工作簿之前,改日期格式? Post By:2020/4/2 16:41:00 [显示全部帖子]
在打开工作簿之前,改日期格式? 但是,试过插在哪一行都不对??? 以下是问题代码:
Dim ckl As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")Dim nms As New List(of String)For i As Integer = 0 To ckl.Items.count - 1 '获取已经勾选的列 If ckl.GetItemChecked(i) Then nms.Add(ckl.Items(i)) End IfNextIf nms.Count = 0 Then MessageBox.Show("至少要选择一列","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) ReturnEnd If '生成Excel表Dim dt As Table = Tables("意和表窗口_意和表")Dim Book As New XLS.BookDim Sheet As XLS.Sheet = Book.Sheets(0)For i As Integer = 0 To nms.count -1 Sheet(0, i).Value = nms(i)NextFor r As Integer = 0 To dt.Rows.Count - 1 '填入数据 For i As Integer = 0 To nms.count -1 Sheet(r + 1, i).Value = dt.rows(r)(nms(i)) NextNext '保存并打开excel文件Book.Save("D:\项目\cs005\test.xls")Dim St2 As XLS.Style = Book.NewStyleSt2.Format = "yyyy-MM-dd"Sheet.Cols(dt.Cols("出库日期").Index).Style = st2Dim Proc As New ProcessProc.File = "D:\项目\cs005\test.xls"Proc.Start()
|
|