Csv优于编码1250 [英] Csv to excel with coding 1250
本文介绍了Csv优于编码1250的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好如何在此代码中设置编码窗口-1250?
谢谢
我尝试了什么:
我试图将textplatform更改为1250但没有任何反应。
Hi how can I set coding windows-1250 in this code?
thank you
What I have tried:
I tried to change textplatform to 1250 but nothing happen.
Private Sub konverze(sender As Object, e As EventArgs)
Dim msExcelApplication As New Microsoft.Office.Interop.Excel.Application()
Dim workBook As Microsoft.Office.Interop.Excel.Workbook = msExcelApplication.Workbooks.Open("C:\Users\cahafi\Documents\vbexcel.xlsx", 0, False, Type.Missing, "", "", True, Type.Missing, Type.Missing, True, False, Type.Missing, True, False, False)
Try
Dim workSheet As Microsoft.Office.Interop.Excel.Worksheet = workBook.Sheets(1)
With workSheet.QueryTables.Add(Connection:="TEXT;C:\Users\cahafi\Documents\vbexcel.csv", Destination:=workSheet.Range("$A$1"))
.Name = "vbexcel"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.SavePassword = False
.RefreshStyle = Microsoft.Office.Interop.Excel.XlCellInsertionMode.xlInsertDeleteCells
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1250
.TextFileStartRow = 1
.TextFileParseType = Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited
.TextFileTextQualifier = Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileTrailingMinusNumbers = True
.Refresh(BackgroundQuery:=False)
End With
Catch ex As Exception
Console.WriteLine(ex.ToString())
Console.ReadLine()
Finally
workBook.Close(True)
End Try
End Sub
推荐答案
A
1))
.Name =vbexcel
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.SavePassword = False
.RefreshStyle = Microsoft.Office.Interop.Excel.XlCellInsertionMode.xlInsertDeleteCells
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1250
.TextFileStartRow = 1
.TextFileParseType = Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited
.TextFileTextQualifier = Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileTrailingMinusNumbers = True
.Refresh(BackgroundQuery:= False)
以
结尾Catch ex As Exception
Console.WriteLine(ex.ToString())
Console.ReadLine()
Fin ally
workBook.Close(True)
结束尝试
结束次级
1")) .Name = "vbexcel" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .SavePassword = False .RefreshStyle = Microsoft.Office.Interop.Excel.XlCellInsertionMode.xlInsertDeleteCells .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 1250 .TextFileStartRow = 1 .TextFileParseType = Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited .TextFileTextQualifier = Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileTrailingMinusNumbers = True .Refresh(BackgroundQuery:=False) End With Catch ex As Exception Console.WriteLine(ex.ToString()) Console.ReadLine() Finally workBook.Close(True) End Try End Sub
将Excel的默认编码更改为UTF-8? - 超级用户 [ ^ ]
c#,Excel + csv:如何获得正确的编码? - 堆栈溢出 [ ^ ]
这篇关于Csv优于编码1250的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文