溜溜问答 > 平面设计 > CAD问答 > Excel表格复制粘贴到CAD 字体重叠是怎么回事?
kiss mayue
kiss mayue
邀请你来回答
422人阅读 2021-02-24

Excel表格复制粘贴到CAD 字体重叠是怎么回事?

我要回答
2个回答

文字大小设置不合适吧,在粘贴到CAD中时应该有一个对话框提示输入字体大小,改一下试试。

CAD小苗 微信公众号 新浪博客

查看全部
2021-02-24
回复 采纳

用vba实现Excel表格到CAD。下面代码供参考。
attribute vb_name = "模块3"
'该程序来自vba二次开发CAD技术
SUb 根据Excel自动画表()
dim xlapp as Excel.application
set xlapp = getobject(, "Excel.application")
dim xlsheet as worksheet
set xlsheet = xlapp.activesheet
dim ipt(0 to 2) as double
ipt(0) = 0: ipt(1) = 0: ipt(2) = 0
dim blockobj as aCADblock
set blockobj = thisdraWing.blocks("*model_space")
dim xlrange as range
For each xlrange in xlsheet.usedrange
addline blockobj, xlrange
addtext blockobj, xlrange
next
set xlrange = nothing
set xlsheet = nothing
set xlapp = nothing
end SUb

'边框处理
SUb addline(byref blockobj as aCADblock, byval xlrange as range)
dim rl as double
dim rt as double
dim rw as double
dim rh as double
rl = xlrange.left / 2.835
rt = xlrange.top / 2.835
rw = xlrange.wIDth / 2.835
rh = xlrange.height / 2.835
dim PPT(0 to 3) as double
dim plineobj as aCADlwpolyline
if xlrange.borders(xledgeleft).linestyle <> xlnone and xlrange.column = 1 then
PPT(0) = rl: PPT(1) = -rt
PPT(2) = rl: PPT(3) = -(rl + rh)
set plineobj = blockobj.addlightweightpolyline(PPT)
with xlrange.borders(xledgeleft)
if .colorindex <> xlAutomatic then
if .colorindex = 3 then
plineobj.color = aCRed
elseif .colorindex = 4 then
plineobj.color = acgreen
elseif .colorindex = 5 then
plineobj.color = acblue
elseif .colorindex = 6 then
plineobj.color = acyellow
elseif .colorindex = 8 then
plineobj.color = aCCyan
elseif .colorindex = 9 then
plineobj.color = acmagenta
end if
end if
if .weight = xlthin then
plineobj.constantwIDth = 0
elseif .weight = xlmedium then
plineobj.constantwIDth = 0.35
elseif .weight = xlthick then
plineobj.constantwIDth = 0.7
end if
end with
end if
if xlrange.borders(xledgebottom).linestyle <> xlnone and (xlrange.row = xlrange.mergearea.row + xlrange.mergearea.rows.count - 1) then
PPT(0) = rl: PPT(1) = -(rt + rh)
PPT(2) = rl + rw: PPT(3) = -(rt + rh)
set plineobj = blockobj.addlightweightpolyline(PPT)
with xlrange.borders(xledgebottom)
if .colorindex <> xlAutomatic then
if .colorindex = 3 then
plineobj.color = aCRed
elseif .colorindex = 4 then
plineobj.color = acgreen
elseif .colorindex = 5 then
plineobj.color = acblue
elseif .colorindex = 6 then
plineobj.color = acyellow
elseif .colorindex = 8 then
plineobj.color = aCCyan
elseif .colorindex = 9 then
plineobj.color = acmagenta
end if
end if
if .weight = xlthin then
plineobj.constantwIDth = 0
elseif .weight = xlmedium then
plineobj.constantwIDth = 0.35
elseif .weight = xlthick then
plineobj.constantwIDth = 0.7
end if
end with
end if
if xlrange.borders(xledgeright).linestyle <> xlnone and (xlrange.column >= xlrange.mergearea.column + xlrange.mergearea.columns.count - 1) then
PPT(0) = rl + rw: PPT(1) = -(rt + rh)
PPT(2) = rl + rw: PPT(3) = -rt
set plineobj = blockobj.addlightweightpolyline(PPT)
with xlrange.borders(xledgeright)
if .colorindex <> xlAutomatic then
if .colorindex = 3 then
plineobj.color = aCRed
elseif .colorindex = 4 then
plineobj.color = acgreen
elseif .colorindex = 5 then
plineobj.color = acblue
elseif .colorindex = 6 then
plineobj.color = acyellow
elseif .colorindex = 8 then
plineobj.color = aCCyan
elseif .colorindex = 9 then
plineobj.color = acmagenta
end if
end if
if .weight = xlthin then
plineobj.constantwIDth = 0
elseif .weight = xlmedium then
plineobj.constantwIDth = 0.35
elseif .weight = xlthick then
plineobj.constantwIDth = 0.7
end if
end with
end if
if xlrange.borders(xledgetop).linestyle <> xlnone and xlrange.top = 1 then
PPT(0) = rl + rw: PPT(1) = -rt
PPT(2) = rl: PPT(3) = -rt
set plineobj = blockobj.addlightweightpolyline(PPT)
with xlrange.borders(xledgetop)
if .colorindex <> xlAutomatic then
if .colorindex = 3 then
plineobj.color = aCRed
elseif .colorindex = 4 then
plineobj.color = acgreen
elseif .colorindex = 5 then
plineobj.color = acblue
elseif .colorindex = 6 then
plineobj.color = acyellow
elseif .colorindex = 8 then
plineobj.color = aCCyan
elseif .colorindex = 9 then
plineobj.color = acmagenta
end if
end if
if .weight = xlthin then
plineobj.constantwIDth = 0
elseif .weight = xlmedium then
plineobj.constantwIDth = 0.35
elseif .weight = xlthick then
plineobj.constantwIDth = 0.7
end if
end with
end if
set plineobj = nothing
end SUb

'文字处理
SUb addtext(byref blockobj as aCADblock, byval xlrange as range)
if xlrange.text = "" then exit SUb
dim rl as double
dim rt as double
dim rw as double
dim rh as double
rl = xlrange.left / 2.835
rt = xlrange.top / 2.835
rw = xlrange.mergearea.wIDth / 2.835
rh = xlrange.mergearea.height / 2.835
dim ipt(0 to 2) as double
ipt(0) = rl: ipt(1) = -rt: ipt(2) = 0
dim mtextobj as aCADmtext
set mtextobj = blockobj.addmtext(ipt, rw, xlrange.text)
dim tpt as variant
if xlrange.verticalalignment = xltop and (xlrange.horizontalalignment = xlleft or xlrange.horizontalalignment = xlgeneral) then
mtextobj.attachmentpoint = acattachmentpointtopleft
mtextobj.insertionpoint = ipt
elseif xlrange.verticalalignment = xltop and xlrange.horizontalalignment = xlcenter then
mtextobj.attachmentpoint = acattachmentpointtopcenter
tpt = thisdraWing.utility.polarpoint(ipt, 0, rw / 2)
elseif xlrange.verticalalignment = xltop and xlrange.horizontalalignment = xlright then
mtextobj.attachmentpoint = acattachmentpointtoPRight
tpt = thisdraWing.utility.polarpoint(ipt, 0, rw)
elseif xlrange.verticalalignment = xlcenter and (xlrange.horizontalalignment = xlleft _
or xlrange.horizontalalignment = xlgeneral) then
mtextobj.attachmentpoint = acattachmentpointmIDdleleft
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh / 2)
elseif xlrange.verticalalignment = xlcenter and xlrange.horizontalalignment = xlcenter then
mtextobj.attachmentpoint = acattachmentpointmIDdlecenter
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh / 2)
tpt = thisdraWing.utility.polarpoint(tpt, 0, rw / 2)
elseif xlrange.verticalalignment = xlcenter and xlrange.horizontalalignment = xlright then
mtextobj.attachmentpoint = acattachmentpointmIDdleright
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh / 2)
tpt = thisdraWing.utility.polarpoint(tpt, 0, rw / 2)
elseif xlrange.verticalalignment = xlbottom and (xlrange.horizontalalignment = xlleft _
or xlrange.horizontalalignment = xlgeneral) then
mtextobj.attachmentpoint = acattachmentpointbottomleft
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh)
elseif xlrange.verticalalignment = xlbottom and xlrange.horizontalalignment = xlcenter then
mtextobj.attachmentpoint = acattachmentpointbottomcenter
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh)
tpt = thisdraWing.utility.polarpoint(tpt, 0, rw / 2)
elseif xlrange.verticalalignment = xlbottom and xlrange.horizontalalignment = xlright then
mtextobj.attachmentpoint = acattachmentpointbottomright
tpt = thisdraWing.utility.polarpoint(ipt, -1.5707963, rh)
tpt = thisdraWing.utility.polarpoint(tpt, 0, rw)
end if
mtextobj.insertionpoint = tpt
set mtextobj = nothing
end SUb

查看全部
2021-02-24
回复 采纳

相关问题

CAD粘贴Excel表格,字体重叠如何解决?
共4条回答 >
b.o.: 打开CAD用选择性粘贴--CAD版本,就可以直接是CAD版本显示!
回复
Excel表格复制粘贴不了怎么回事?
共3条回答 >
易小茗: 1、不能复制粘贴,有可能是是设置了安全性方面的数据保护功能。有些Excel表格、Word文档可以设置安全性,有些是可看,但不可复制;有些是没密码不允许查看,有些是可看但不允许修改……估计你就是这种状况。2、你所说的两个不能复制粘贴,也有可能是你要粘贴位置的那张表格和你复制的表格两个单元格设置的不同,造成无法粘贴。比如:你把一个三行三列的表格数据复制后,要粘贴到二行二列的表格里面,这样不对称的先列,可能会破坏原本的表和数据类型,类似这样的情况下是不被允许的。如果非要这样操作,你可适当的把二行二列的....
(5) 回复
Word文档部分字体重叠怎么回事?
共2条回答 >
: 可以尝试设置字体、调整字符间距;或者是ctrl+a选中全部字体,然后清楚所有字体格式。Word中文字重叠问题分析一、文本框文字的原因,如果设置了文本框文字嵌入格式不对的话,会出现重叠的现象;二、表格漂浮,表格的格式设置的不对,也会出现重叠,(如果你没有看到表格的边框,有可能表格没加框,文字重叠的现象照样会出现的);至于说是行距的问题的,基本上是不存在的,因为行距没有调好,顶多会出现一个字没出现不完整,是不可能出现文字重叠的现象的。解决步骤1、可能是Word中字体间距的问题,选中重叠在一起的文字,....
回复
Excel表格复制粘贴不出来怎么回事?
共1条回答 >
好大展: 1、先看下现在所处的行数,Excel2003版最大行数是65536行。Excel2007开始的版本最大行数是1048576行,如果数据超过了这个限制,那么无论你怎么设置,都是不可能粘贴上的。2、确定工作表是不是都在锁定状态,如果是锁定状态,是粘贴不上的。解决方法很简单,只要单击其中之一,即可解除锁定状态。3、粘贴的时候是否选中了一个表格?如果是,请看下一步。4、不选中一个单元格,而是选中多行,注意是整行,然后粘贴。5、此外还有粘贴源单元格锁定的情况,解决方法:右键-设置单元格格式-保护,那里有个....
(1) 回复
在CAD里面粘贴表格,表格里面的字体重叠在一起怎么回事,求指导?
共0条回答 >
发表成功!
感谢您的分享!
好的