w的w文档怎么制作表格怎么框

用W软件做表格格式为PDF
导读:用WPS软件做表格格式为PDF,这样也节约了用其它软件来弄,WPS和excel及word是很相同的用法&&&&&&先打开WPS软件,录好自己需要的数据信息。然后让我们来看下具体操作方法,很简单的。&&&&&&&...
[ 责任编辑:gaosu ]
赞助商链接【图文】word2003表格制作_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
word2003表格制作
上传于||文档简介
&&w​o​r​d​表​格​制​作​课​件
大小:261.50KB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢我用dreamweaver设计的表,怎么让表格有边框而某些单元格没有边框,_百度知道
我用dreamweaver设计的表,怎么让表格有边框而某些单元格没有边框,
有就是IE和火狐显示出来的效果不一样? 表格位置也不一样,怎么解决,IE没有边框而火狐有
提问者采纳
tr&/body&gt!DOCTYPE html PUBLIC &quot.w3;&/&/tr&td&gt.org/1999/xhtml&&td style=&td&EN&Content-Type&/
&html xmlns=&quot.w3;tr&&#47.w3;http:none&quot://tr& & //head&meta http-equiv=&table width=& charset=utf-8&head&gt.org/TR/xhtml1/DTD/xhtml1-/ &lt.org/TR/xhtml1/DTD/xhtml1-transitional:1px #0033FF dashed&&&&#47.dtd&你好好研究一下table以及css的border属性祝你成功:&
&/table&&html&gt
提问者评价
谢谢你的耐心解答,好详细呀
其他类似问题
为您推荐:
dreamweaver的相关知识
其他2条回答
你把代码贴出来看看
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁poi word2007设置表格边框样式
&直接上代码:& &
import java.io.FileOutputS
import java.math.BigI
import java.util.ArrayL
import java.util.L
import org.apache.poi.xwpf.usermodel.BreakT
import org.apache.poi.xwpf.usermodel.XWPFD
import org.apache.poi.xwpf.usermodel.XWPFP
import org.apache.poi.xwpf.usermodel.XWPFT
import org.apache.poi.xwpf.usermodel.XWPFTableC
import org.apache.poi.xwpf.usermodel.XWPFTableR
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTB
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTS
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTT
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblB
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblW
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STB
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STM
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblW
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalJc;
public class POI_表格边框相关_S2_Test {
public static void main(String[] args) throws Exception {
POI_表格边框相关_S2_Test t=new POI_表格边框相关_S2_Test();
XWPFDocument document = new XWPFDocument();
t.createSimpleTableWithBdColor(document);
t.addNewPage(document, BreakType.TEXT_WRAPPING);
t.createSimpleTableNormal(document);
t.addNewPage(document, BreakType.TEXT_WRAPPING);
t.createSimpleTableWithNotBd(document);
t.saveDocument(document, &f:/saveFile/temp/sys_&+ System.currentTimeMillis() + &.docx&);
//表格自定义边框 请忽略这么丑的颜色样式,主要说明可以自定义样式
void createSimpleTableWithBdColor(XWPFDocument doc) throws Exception {
List&String& columnList = new ArrayList&String&();
columnList.add(&序号&);
columnList.add(&姓名信息|姓甚|名谁&);
columnList.add(&名刺信息|籍贯|营生&);
XWPFTable table = doc.createTable(2,5);
CTTblBorders borders=table.getCTTbl().getTblPr().addNewTblBorders();
CTBorder hBorder=borders.addNewInsideH();
hBorder.setVal(STBorder.Enum.forString(&dashed&));
hBorder.setSz(new BigInteger(&1&));
hBorder.setColor(&0000FF&);
CTBorder vBorder=borders.addNewInsideV();
vBorder.setVal(STBorder.Enum.forString(&dotted&));
vBorder.setSz(new BigInteger(&1&));
vBorder.setColor(&00FF00&);
CTBorder lBorder=borders.addNewLeft();
lBorder.setVal(STBorder.Enum.forString(&double&));
lBorder.setSz(new BigInteger(&1&));
lBorder.setColor(&3399FF&);
CTBorder rBorder=borders.addNewRight();
rBorder.setVal(STBorder.Enum.forString(&single&));
rBorder.setSz(new BigInteger(&1&));
rBorder.setColor(&F2B11F&);
CTBorder tBorder=borders.addNewTop();
tBorder.setVal(STBorder.Enum.forString(&thick&));
tBorder.setSz(new BigInteger(&1&));
tBorder.setColor(&C3599D&);
CTBorder bBorder=borders.addNewBottom();
bBorder.setVal(STBorder.Enum.forString(&wave&));
bBorder.setSz(new BigInteger(&1&));
bBorder.setColor(&BF6BCC&);
CTTbl ttbl = table.getCTTbl();
CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
CTJc cTJc=tblPr.addNewJc();
cTJc.setVal(STJc.Enum.forString(&center&));
tblWidth.setW(new BigInteger(&8000&));
tblWidth.setType(STTblWidth.DXA);
XWPFTableRow firstRow=
XWPFTableRow secondRow=
XWPFTableCell firstCell=
XWPFTableCell secondCell=
for(int i=0;i&2;i++){
firstRow=table.getRow(i);
firstRow.setHeight(380);
for(int j=0;j&5;j++){
firstCell=firstRow.getCell(j);
setCellText(firstCell, &测试&, &FFFFC9&, 1600);
firstRow=table.insertNewTableRow(0);
secondRow=table.insertNewTableRow(1);
firstRow.setHeight(380);
secondRow.setHeight(380);
for(String str:columnList){
if(str.indexOf(&|&) == -1){
firstCell=firstRow.addNewTableCell();
secondCell=secondRow.addNewTableCell();
createVSpanCell(firstCell, str,&CCCCCC&,1600,STMerge.RESTART);
createVSpanCell(secondCell, &&, &CCCCCC&, 1600,null);
String[] strArr=str.split(&\\|&);
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, strArr[0],&CCCCCC&,1600,STMerge.RESTART);
for(int i=1;i&strArr.length-1;i++){
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, &&,&CCCCCC&,1600,null);
for(int i=1;i&strArr.i++){
secondCell=secondRow.addNewTableCell();
setCellText(secondCell, strArr[i], &CCCCCC&, 1600);
//表格正常边框
void createSimpleTableNormal(XWPFDocument doc) throws Exception {
List&String& columnList = new ArrayList&String&();
columnList.add(&序号&);
columnList.add(&姓名信息|姓甚|名谁&);
columnList.add(&名刺信息|籍贯|营生&);
XWPFTable table = doc.createTable(2,5);
CTTbl ttbl = table.getCTTbl();
CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
CTJc cTJc=tblPr.addNewJc();
cTJc.setVal(STJc.Enum.forString(&center&));
tblWidth.setW(new BigInteger(&8000&));
tblWidth.setType(STTblWidth.DXA);
XWPFTableRow firstRow=
XWPFTableRow secondRow=
XWPFTableCell firstCell=
XWPFTableCell secondCell=
for(int i=0;i&2;i++){
firstRow=table.getRow(i);
firstRow.setHeight(380);
for(int j=0;j&5;j++){
firstCell=firstRow.getCell(j);
setCellText(firstCell, &测试&, &FFFFC9&, 1600);
firstRow=table.insertNewTableRow(0);
secondRow=table.insertNewTableRow(1);
firstRow.setHeight(380);
secondRow.setHeight(380);
for(String str:columnList){
if(str.indexOf(&|&) == -1){
firstCell=firstRow.addNewTableCell();
secondCell=secondRow.addNewTableCell();
createVSpanCell(firstCell, str,&CCCCCC&,1600,STMerge.RESTART);
createVSpanCell(secondCell, &&, &CCCCCC&, 1600,null);
String[] strArr=str.split(&\\|&);
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, strArr[0],&CCCCCC&,1600,STMerge.RESTART);
for(int i=1;i&strArr.length-1;i++){
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, &&,&CCCCCC&,1600,null);
for(int i=1;i&strArr.i++){
secondCell=secondRow.addNewTableCell();
setCellText(secondCell, strArr[i], &CCCCCC&, 1600);
//表格无边框
void createSimpleTableWithNotBd(XWPFDocument doc) throws Exception {
List&String& columnList = new ArrayList&String&();
columnList.add(&序号&);
columnList.add(&姓名信息|姓甚|名谁&);
columnList.add(&名刺信息|籍贯|营生&);
XWPFTable table = doc.createTable(2,5);
CTTblBorders borders=table.getCTTbl().getTblPr().addNewTblBorders();
CTBorder hBorder=borders.addNewInsideH();
hBorder.setVal(STBorder.Enum.forString(&none&));
hBorder.setSz(new BigInteger(&1&));
hBorder.setColor(&0000FF&);
CTBorder vBorder=borders.addNewInsideV();
vBorder.setVal(STBorder.Enum.forString(&none&));
vBorder.setSz(new BigInteger(&1&));
vBorder.setColor(&00FF00&);
CTBorder lBorder=borders.addNewLeft();
lBorder.setVal(STBorder.Enum.forString(&none&));
lBorder.setSz(new BigInteger(&1&));
lBorder.setColor(&3399FF&);
CTBorder rBorder=borders.addNewRight();
rBorder.setVal(STBorder.Enum.forString(&none&));
rBorder.setSz(new BigInteger(&1&));
rBorder.setColor(&F2B11F&);
CTBorder tBorder=borders.addNewTop();
tBorder.setVal(STBorder.Enum.forString(&none&));
tBorder.setSz(new BigInteger(&1&));
tBorder.setColor(&C3599D&);
CTBorder bBorder=borders.addNewBottom();
bBorder.setVal(STBorder.Enum.forString(&none&));
bBorder.setSz(new BigInteger(&1&));
bBorder.setColor(&F7E415&);
CTTbl ttbl = table.getCTTbl();
CTTblPr tblPr = ttbl.getTblPr() == null ? ttbl.addNewTblPr() : ttbl.getTblPr();
CTTblWidth tblWidth = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
CTJc cTJc=tblPr.addNewJc();
cTJc.setVal(STJc.Enum.forString(&center&));
tblWidth.setW(new BigInteger(&8000&));
tblWidth.setType(STTblWidth.DXA);
XWPFTableRow firstRow=
XWPFTableRow secondRow=
XWPFTableCell firstCell=
XWPFTableCell secondCell=
for(int i=0;i&2;i++){
firstRow=table.getRow(i);
firstRow.setHeight(380);
for(int j=0;j&5;j++){
firstCell=firstRow.getCell(j);
setCellText(firstCell, &测试&, &FFFFC9&, 1600);
firstRow=table.insertNewTableRow(0);
secondRow=table.insertNewTableRow(1);
firstRow.setHeight(380);
secondRow.setHeight(380);
for(String str:columnList){
if(str.indexOf(&|&) == -1){
firstCell=firstRow.addNewTableCell();
secondCell=secondRow.addNewTableCell();
createVSpanCell(firstCell, str,&CCCCCC&,1600,STMerge.RESTART);
createVSpanCell(secondCell, &&, &CCCCCC&, 1600,null);
String[] strArr=str.split(&\\|&);
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, strArr[0],&CCCCCC&,1600,STMerge.RESTART);
for(int i=1;i&strArr.length-1;i++){
firstCell=firstRow.addNewTableCell();
createHSpanCell(firstCell, &&,&CCCCCC&,1600,null);
for(int i=1;i&strArr.i++){
secondCell=secondRow.addNewTableCell();
setCellText(secondCell, strArr[i], &CCCCCC&, 1600);
void setCellText(XWPFTableCell cell,String text, String bgcolor, int width) {
CTTc cttc = cell.getCTTc();
CTTcPr cellPr = cttc.addNewTcPr();
cellPr.addNewTcW().setW(BigInteger.valueOf(width));
//cell.setColor(bgcolor);
CTTcPr ctPr = cttc.addNewTcPr();
CTShd ctshd = ctPr.addNewShd();
ctshd.setFill(bgcolor);
ctPr.addNewVAlign().setVal(STVerticalJc.CENTER);
cttc.getPList().get(0).addNewPPr().addNewJc().setVal(STJc.CENTER);
cell.setText(text);
public void createHSpanCell(XWPFTableCell cell,String value, String bgcolor, int width,STMerge.Enum stMerge){
CTTc cttc = cell.getCTTc();
CTTcPr cellPr = cttc.addNewTcPr();
cellPr.addNewTcW().setW(BigInteger.valueOf(width));
cell.setColor(bgcolor);
cellPr.addNewHMerge().setVal(stMerge);
cellPr.addNewVAlign().setVal(STVerticalJc.CENTER);
cttc.getPList().get(0).addNewPPr().addNewJc().setVal(STJc.CENTER);
cttc.getPList().get(0).addNewR().addNewT().setStringValue(value);
public void createVSpanCell(XWPFTableCell cell,String value, String bgcolor, int width,STMerge.Enum stMerge){
CTTc cttc = cell.getCTTc();
CTTcPr cellPr = cttc.addNewTcPr();
cellPr.addNewTcW().setW(BigInteger.valueOf(width));
cell.setColor(bgcolor);
cellPr.addNewVMerge().setVal(stMerge);
cellPr.addNewVAlign().setVal(STVerticalJc.CENTER);
cttc.getPList().get(0).addNewPPr().addNewJc().setVal(STJc.CENTER);
cttc.getPList().get(0).addNewR().addNewT().setStringValue(value);
public void addNewPage(XWPFDocument document,BreakType breakType){
XWPFParagraph xp = document.createParagraph();
xp.createRun().addBreak(breakType);
public void saveDocument(XWPFDocument document,String savePath) throws Exception{
FileOutputStream fos = new FileOutputStream(savePath);
document.write(fos);
fos.close();
&&& 结果如下:
您可能也会对以下文章感兴趣
QQ : 341470
Friend Link
New Member

我要回帖

更多关于 w表格制作教程 的文章

 

随机推荐