vb.net文档另存为 vb文件保存
VB,NET 如何把WORD另存为HTML
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
创新互联建站是一家专业提供奇台企业网站建设,专注与成都网站建设、成都网站设计、H5开发、小程序制作等业务。10年已为奇台众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。
'定义Word对象
Dim wordApp As New Word.ApplicationClass
'要转换的文件名
Dim fileName As Object = "E:\Test.doc"
'默认值
Dim miss As Object = System.Reflection.Missing.Value
'打开要转换的 DOC 文件
Dim doc As Word.Document = DirectCast(wordApp.Documents.Open(fileName, miss, miss, miss, miss, miss, _
miss, miss, miss, miss, miss, miss, _
miss, miss, miss, miss), Word.Document)
'转换后的文件名
fileName = "E:\testDoc.HTML"
'保存的文件格式
Dim saveFormat As Object = Word.WdSaveFormat.wdFormatHTML
'按文本文件保存
doc.SaveAs(fileName, saveFormat, miss, miss, miss, miss, _
miss, miss, miss, miss, miss, miss, _
miss, miss, miss, miss)
'关闭是否保存文件,这里为不保存
Dim changes As Object = False
'关闭文件
doc.Close(changes, miss, miss)
'退出 Word 应用程序
wordApp.Quit(changes, miss, miss)
End Sub
vb.net保存另存
你就不能这样保存么? ↓
Static SaveNumber as Integer
SaveNumber += 1
Dim SavePath as String = "C:\ytakqi" SaveNumber ".png"
bit.Save(SavePath)
用vb.net编写写字板时怎么实现保存与另存为
可以用SaveFileDialog1对话框加上对文件数据操作的类来实现,,用richtextbox自己的属性方法也能行!我以前做过一个记事本程序就是那样的!
vb.net中datagradview 另存为excel文件的问题
Public Class Cls导入数据
Dim xlApp As New Excel.Application()
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim A = "A"
Public Function 导出到Excel(ByVal Dt表 As DataTable) As Boolean
Dim rowIndex, colIndex As Integer
rowIndex = 1
colIndex = 0
xlBook = xlApp.Workbooks().Add
xlSheet = xlBook.Worksheets("sheet1")
Dim Table As New DataTable()
Table = CreaTable()
'将所得到的表的列名,赋值给单元格
Dim Col As DataColumn
Dim Row As DataRow
For Each Col In Table.Columns
colIndex = colIndex + 1
xlApp.Cells(1, colIndex) = Col.ColumnName
Next
'得到的表所有行,赋值给单元格
For Each Row In Table.Rows
rowIndex = rowIndex + 1
colIndex = 0
For Each Col In Table.Columns
colIndex = colIndex + 1
xlApp.Cells(rowIndex, colIndex) = Row(Col.ColumnName)
Next
Next
With xlSheet
.Range(.Cells(1, 1), .Cells(1, colIndex)).Font.Name = "黑体"
'设标题为黑体字
.Range(.Cells(1, 1), .Cells(1, colIndex)).Font.Bold = True
'标题字体加粗
.Range(.Cells(1, 1), .Cells(rowIndex, colIndex)).Borders.LineStyle = 1
'设表格边框样式
End With
With xlSheet.PageSetup
.LeftHeader = "" Chr(10) """楷体_GB2312,常规""10公司名称:" ' Gsmc
.CenterHeader = """楷体_GB2312,常规""公司人员情况表""宋体,常规""" Chr(10) """楷体_GB2312,常规""10日 期:"
.RightHeader = "" Chr(10) """楷体_GB2312,常规""10单位:"
.LeftFooter = """楷体_GB2312,常规""10制表人:"
.CenterFooter = """楷体_GB2312,常规""10制表日期:"
.RightFooter = """楷体_GB2312,常规""10第P页 共N页"
End With
xlApp.SaveWorkspace()
MsgBox("保存完毕", MsgBoxStyle.Exclamation, "提示")
KillAllExcels()
'xlApp.Visible = True
End Function
Sub KillAllExcels()
Dim proc As System.Diagnostics.Process
For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
proc.Kill()
Next
End Sub
end class
VB.net怎样保存文件
保存文件的步骤为:
关闭流,特别是写入流
关闭并保存文件
示例代码如下:
Imports System.Windows.Forms
Imports System.IO
Imports System.Text
Sub SaveFileDemo()
'打开文件。如果文件不存在则创建新的文件
Dim myFile As New IO.FileStream("d:\data.txt", _
FileMode.OpenOrCreate, _
FileAccess.Write)
'在文件末尾添加一行
Dim tw As New StreamWriter(myFile)
myFile.Seek(0, SeekOrigin.End)
tw.WriteLine("白刃格斗英雄连英模部队方队亮相阅兵")
'关闭流
tw.Close()
'关闭文件并保存文件
myFile.Close()
End Sub
vb.net 保存excel弹出一个重命名对话框,另存为到其他盘
添加一个SaveFileDialog,在保存excle选择时候添加
SaveFileDialog1.show()
用法跟OpenFileDialog相同
本文标题:vb.net文档另存为 vb文件保存
文章地址:http://azwzsj.com/article/dooddgs.html