问题1: 单元格里内容该怎么居中对齐?
问题2: 表格边框线的粗细设置问题?针对问题1,我的代码如下:public void alignTable(String align,int tableIndex,int cellRow,int cellColumn )
{
Dispatch tables=Dispatch.call(doc,"Tables").toDispatch();
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex))
.toDispatch();
Dispatch cell = Dispatch.call(table, "Cell", new Variant(cellRow),
new Variant(cellColumn)).toDispatch();
Dispatch.call(cell,"Select");
Dispatch.put(selection,"Alignment","1");
Dispatch.put(tables,"HorizontalAlignment","1");
}其中Dispatch.put(selection,"Alignment","1");
Dispatch.put(tables,"HorizontalAlignment","1");都不能够实现单元格的居中对齐方式!看看高手们有没有高招!针对问题二:我的代码如下: /**
* 设置当前表格线的粗细
* w范围:1<w<13
* 超过范围设为:w=6
* @param w
*/
public void setTableBorderWidth(int w,int tableIndex)
{
if(w > 13 || w < 2)
{
w = 6;
}
Dispatch tables=Dispatch.call(doc,"Tables").toDispatch();
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex))
.toDispatch();
Dispatch borders = Dispatch.get(table, "Borders").toDispatch();
Dispatch.put(borders, "linewidth",new Variant(w));
Dispatch border = null;
/**
* 设置表格线的粗细
* 1:代表最上边一条线 2:代表最左边一条线 3:最下边一条线 4:最右边一条线
* 5:除最上边最下边之外的所有横线 6:除最左边最右边之外的所有竖线
* 7:从左上角到右下角的斜线 8:从左下角到右上角的斜线
*/
for(int i=1; i < 7;i++)
{
border = Dispatch.call(borders, "Item",new Variant(i)).toDispatch();
Dispatch.put(border, "LineWidth", new Variant(w));
Dispatch.put(border, "Visible", new Variant(true));
}
}可是依然会报错,说的是Exception in thread "main" com.jacob.com.ComFailException: Can't map name to dispid: linewidth高手们积极一点来试试看解决一下这个问题吧!
问题2: 表格边框线的粗细设置问题?针对问题1,我的代码如下:public void alignTable(String align,int tableIndex,int cellRow,int cellColumn )
{
Dispatch tables=Dispatch.call(doc,"Tables").toDispatch();
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex))
.toDispatch();
Dispatch cell = Dispatch.call(table, "Cell", new Variant(cellRow),
new Variant(cellColumn)).toDispatch();
Dispatch.call(cell,"Select");
Dispatch.put(selection,"Alignment","1");
Dispatch.put(tables,"HorizontalAlignment","1");
}其中Dispatch.put(selection,"Alignment","1");
Dispatch.put(tables,"HorizontalAlignment","1");都不能够实现单元格的居中对齐方式!看看高手们有没有高招!针对问题二:我的代码如下: /**
* 设置当前表格线的粗细
* w范围:1<w<13
* 超过范围设为:w=6
* @param w
*/
public void setTableBorderWidth(int w,int tableIndex)
{
if(w > 13 || w < 2)
{
w = 6;
}
Dispatch tables=Dispatch.call(doc,"Tables").toDispatch();
Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex))
.toDispatch();
Dispatch borders = Dispatch.get(table, "Borders").toDispatch();
Dispatch.put(borders, "linewidth",new Variant(w));
Dispatch border = null;
/**
* 设置表格线的粗细
* 1:代表最上边一条线 2:代表最左边一条线 3:最下边一条线 4:最右边一条线
* 5:除最上边最下边之外的所有横线 6:除最左边最右边之外的所有竖线
* 7:从左上角到右下角的斜线 8:从左下角到右上角的斜线
*/
for(int i=1; i < 7;i++)
{
border = Dispatch.call(borders, "Item",new Variant(i)).toDispatch();
Dispatch.put(border, "LineWidth", new Variant(w));
Dispatch.put(border, "Visible", new Variant(true));
}
}可是依然会报错,说的是Exception in thread "main" com.jacob.com.ComFailException: Can't map name to dispid: linewidth高手们积极一点来试试看解决一下这个问题吧!
解决方案 »
- 求助:eclipse报错This mapped class is not specified in persistence unit " "
- 求用DWR向后台传一个对象,做一个保存数据的方法!
- 求助!!域名解析的疑惑
- 用JAVA编写网络数据集成系统
- jsp中表格和表单的关联!!!!!!!!!!!!!!
- js 怎么重定向到其他项目下的页面
- 讨论:如何从java中获取系统的音频、视频然后实时广播给客户机
- 在j2ee的系统里,applet通过URLConnection,向服务器的servlet传信息,服务器可以接受,但返回信息时总是.........
- 请教关于java源码防止反编译问题
- EJB与CORBA互通的问题
- 请问JAXB2.0 支持多态吗?
- Jetty 中jsp和servlet之间session问题
楼主【jovenno】截止到2008-08-01 17:17:16的历史汇总数据(不包括此帖):
发帖的总数量:1 发帖的总分数:20 每贴平均分数:20
回帖的总数量:0 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:1 未结的总分数:20
结贴的百分比:0.00 % 结分的百分比:0.00 %
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=jovenno