ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 7244|回复: 11

[求助] 如何将excel 中的文本内容自动生成标签

[复制链接]

TA的精华主题

TA的得分主题

发表于 2018-5-31 22:09 | 显示全部楼层 |阅读模式
如何将这个内容,自动生成标签。 CF011290-31EB-4182-9F4C-5258ABD758D6.jpeg 99E75A3E-B097-4170-AE6C-04862D8F448B.jpeg

TA的精华主题

TA的得分主题

发表于 2018-6-1 05:42 来自手机 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
可以用html生成的。。。
VBA应该也行吧。。。
Screenshot_2018-05-31-10-47-10.png

TA的精华主题

TA的得分主题

 楼主| 发表于 2018-6-1 08:36 来自手机 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2018-6-1 09:58 来自手机 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
zpy2 发表于 2018-6-1 05:42
可以用html生成的。。。
VBA应该也行吧。。。

可以说下具体的步骤吗?谢谢

TA的精华主题

TA的得分主题

发表于 2018-6-1 10:56 来自手机 | 显示全部楼层

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<title>安全审核</title>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Aspose.Cell ">
<link id=Main-File rel=Main-File href="../032913124442.html">
<link rel=File-List href=filelist.xml>
<link rel=Edit-Time-Data href=editdata.mso>
<!--[if !mso]>
<style>
v\\:* {behavior:url(#default#VML);}
o\\:* {behavior:url(#default#VML);}
x\\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

</style>
<![endif]-->
<link rel=Stylesheet href=stylesheet.css>
<style>
.pic {
display:block;
height:120pt;
width:124pt;
}

</style>
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{
mso-header-data:"";
mso-footer-data:"";
margin:0.75in 0.7in 0.75in 0.7in;
mso-header-margin:0.3in;
mso-footer-margin:0.3in;
mso-page-orientation:Portrait;
}
-->
</style>
<![if !supportTabStrip]><script language="JavaScript">
<!--
function fnUpdateTabs()
{
  if (parent.window.g_iIEVer>=4) {
   if (parent.document.readyState=="complete"
    && parent.frames['frTabs'].document.readyState=="complete")
   parent.fnSetActiveSheet(0);
  else
   window.setTimeout("fnUpdateTabs();",150);
}
}

if (window.name!="frSheet")
// window.location.replace("../032913124442.html");
else
// fnUpdateTabs();
//-->
</script>
<![endif]>
<!--[if gte mso 9]><xml>
<x:WorksheetOptions>
<x:StandardWidth>2304</x:StandardWidth>
<x:Print>
  <x:ValidPrinterInfo/>
  <x:PaperSizeIndex>9</x:PaperSizeIndex>
  <x:HorizontalResolution>300</x:HorizontalResolution>
  <x:VerticalResolution>300</x:VerticalResolution>
</x:Print>
<x:Selected/>
</x:WorksheetOptions>
</xml><![endif]-->
</head>

<body link=blue vlink=purple >
<?php
// 序号,考生姓名,性别,考点,考号,考场,候考室,考生号,测试日期,候考入场,测试时间,照片名称

//员工花名册 ) 工号,单位,班组,姓名,职务/工种
$_GET["table"]="员工花名册";

$file='excel.db';
$db=new PDO('sqlite:'.$file);


$field_list="工号,单位,班组,姓名,[职务/工种]";
$fields=explode(",",$field_list);
//print_r($fields);
for($x=0;$x<sizeof($fields);$x++){
$str="<?php echo \$result[\$j]['".$fields[$x]."']; ?>";
//echo "<br>";
//echo htmlentities($str);
}
//die();
$sql=" SELECT ";
$sql.= $field_list;
$sql.=" FROM ";
$sql.=$_GET["table"];
$sql.=" LIMIT ";
$sql.=" 500";

$sql.=";";

$result=$db->query($sql)->fetchAll(PDO::FETCH_ASSOC);

//表体
for($j=0; $j<sizeof($result); $j++)

{

?>


<div class="wrapper" style="position:relative;float:left;margin:15pt;">

<table border=0 cellpadding=0 cellspacing=0 width=359 style='border-collapse:
collapse;>
<col width=72 span=3 style='width:54pt'>
<col width=12 style='mso-width-source:userset;width:9pt'>
<col width=131 style='mso-width-source:userset;width:118pt'>
<tr height=34 style='mso-height-source:userset;height:26.1pt' id='r0'>
<td colspan=3 id='tc0' height=34 class=x82 style='border-right:2px solid windowtext;border-bottom:2px solid windowtext;height:26.1pt;overflow:hidden;' >密闭舱室进入证<br>ENTER TANK BADGE</td>
<td class=x65 width=12 style='width:9pt;' ></td>
<td class=x66 width=131 style='width:98.25pt;' ></td>
</tr>
<tr height=39 style='mso-height-source:userset;height:29.8pt' id='r1'>
<td height=39 class=x67 style='height:29.8pt;' >单位</td>
<td colspan=2 id='tc1' class=x83 style='border-right:2px solid windowtext;border-bottom:1px solid windowtext;' ><?php echo $result[$j]['单位']; ?></td>
<td class=x70></td>
<td class=x71>安全审核</td>
</tr>
<tr height=22 style='mso-height-source:userset;height:16.7pt' id='r2'>
<td height=22 class=x67 style='height:16.7pt;' >班组</td>
<td colspan=2 id='tc2' class=x84 style='border-right:2px solid windowtext;border-bottom:1px solid windowtext;' ><?php echo $result[$j]['班组']; ?>
</td>
<td class=x70></td>
<td class=x74>盖章</td>
</tr>
<tr height=22 style='mso-height-source:userset;height:16.7pt' id='r3'>
<td height=22 class=x67 style='height:16.7pt;' >姓名</td>
<td colspan=2 id='tc3' class=x84 style='border-right:2px solid windowtext;border-bottom:1px solid windowtext;' ><?php echo $result[$j]['姓名']; ?>
</td>
<td class=x70></td>
<td class=x75></td>
</tr>
<tr height=32 style='mso-height-source:userset;height:24.55pt' id='r4'>
<td height=32 class=x67 style='height:24.55pt;' >职务/工种</td>
<td colspan=2 id='tc4' class=x84 style='border-right:2px solid windowtext;border-bottom:1px solid windowtext;' ><?php echo $result[$j]['职务/工种']; ?></td>
<td class=x70></td>
<td class=x76>2018年有效</td>
</tr>
<tr height=34 style='mso-height-source:userset;height:26.1pt' id='r5'>
<td colspan=2 id='tc5' height=34 class=x85 style='border-right:1px solid windowtext;border-bottom:1px solid windowtext;height:26.1pt;' ><img class="pic" src='
<?php $host  = $_SERVER['HTTP_HOST'];
$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = '/';
echo "http://$host$uri/";?>
workID/pic/<?php echo $result[$j]['姓名']; ?>.jpg'></td>
<td class=x79>特证<br>S.L</td>
<td class=x80></td>
<td class=x81></td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
  <td width=72 style='width:54pt'></td>
  <td width=72 style='width:54pt'></td>
  <td width=72 style='width:54pt'></td>
  <td width=12 style='width:9pt'></td>
  <td width=131 style='width:98.25pt'></td>
</tr>
<![endif]>
</table>
</div>

<script language = 'javascript' type='text/javascript'>
function ChangeColspanHiddenData()
{
   var node;
   var ids=["tc3","tc0","tc1","tc4","tc5","tc2"];
   var spans=["2","3","2","2","2","2"];
   for (var i = 0;i < ids.length; i++)
   {
       node=document.getElementById(ids[i]);
       node.colSpan=spans[i];
   }
}
ChangeColspanHiddenData();
</script>

<?php

}
?>


</body>


</html>























就是代码啊。。。

TA的精华主题

TA的得分主题

 楼主| 发表于 2018-6-2 14:03 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2018-6-2 14:05 来自手机 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
shihyf 发表于 2018-6-2 14:03
vba代码与html代码一样吗?

原理是差不多的,都是循环

TA的精华主题

TA的得分主题

 楼主| 发表于 2018-6-2 14:10 | 显示全部楼层
zpy2 发表于 2018-6-2 14:05
原理是差不多的,都是循环

那段代码放在哪里呢?可以把html代码放到vba里面运行吗
屏幕快照 2018-06-02 下午1.57.11.png

TA的精华主题

TA的得分主题

发表于 2018-6-2 14:15 来自手机 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2018-6-2 14:15 来自手机 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-3-29 03:24 , Processed in 0.051465 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表