用mapinfo打开excel文件并另存为mapinfo表,并把数据类型改一致去更新原mapinfo表,始终不行QQ:11272825

最初的设想是在mapinfo里输入一些东西太麻烦,然后导出来想在excel里输好数据,再转到mapinfo的表中,怎样实现,我用上述办法始终不行,检查了N次,不晓得问题出... 最初的设想是在mapinfo里输入一些东西太麻烦,然后导出来想在excel里输好数据,再转到mapinfo 的表中,怎样实现,我用上述办法始终不行,检查了N次,不晓得问题出在哪里,请赐教,新手感激不尽!!!QQ11272825 展开
 我来答
话广州
2011-07-05 · TA获得超过728个赞
知道小有建树答主
回答量:814
采纳率:100%
帮助的人:384万
展开全部
另存成mapinfo自己的格式就可以修改了。
mapbasic写excel数据,需要用DDE相关的命令。自己在帮助里面找关键词。

下面是 Example

Dim chan_num, tab_marker As Integer
Dim topiclist, topicname, cell As String

chan_num = DDEInitiate("EXCEL", "System")
If chan_num = 0 Then
Note "Excel is not responding."
End Program
End If

' Get a list of Excel's valid topics
topiclist = DDERequest$(chan_num, "topics")

' Topics in the list are separated by tabs.
' If Excel 4 is running, topiclist might look like:
' ": Sheet1 System"
' (if spreadsheet is still "unnamed"),or like:

' ": C:Orders.XLS Sheet1 System"
'
' If Excel 5 is running, topiclist might look like:
' "[Book1]Sheet1 [Book2]Sheet2 ..."
'
' Next,extract just the first topic (e.g."Sheet1")
' by extracting the text between the 1st & 2nd tabs;
' or, in the case of Excel 5, by extracting the text
' that appears before the first tab.

If Left$(topiclist, 1) = ":" Then
' ...then it's Excel 4.
tab_marker = InStr(3, topiclist, Chr$(9) )
If tab_marker = 0 Then

Note "No Excel documents in use! Stopping."
End Program
End If
topicname = Mid$(topiclist, 3, tab_marker - 3)
Else
' ... assume it's Excel 5.
tab_marker = Instr(1, topiclist, Chr$(9) )
topicname = Left$( topiclist, tab_marker - 1)
End If

' open a channel to the specific document
' (e.g. "Sheet1")
DDETerminate chan_num
chan_num = DDEInitiate("Excel", topicname)
If chan_num = 0 Then
Note "Problem communicating with " + topicname

End Program
End If

' Let's examine the 1st cell in Excel.
' If cell is blank, put a message in the cell.
' If cell isn't blank, don't alter it -
' just display cell contents in a MapBasic NOTE.
' Note that a "Blank cell" gets returned as a
' carriage-return line-feed sequence:
' Chr$(13) + Chr$(10).
cell = DDERequest$( chan_num, "R1C1" )
If cell <> Chr$(13) + Chr$(10) Then
Note
"Message not sent; cell already contains:" + cell
Else
DDEPoke chan_num, "R1C1", "Hello from MapInfo!"

Note "Message sent to Excel,"+topicname+ ",R1C1."
End If
DDETerminateAll
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式