Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3265592 建立时间:2005年6月6日 |

| |
[delpih编程]在aspx中调用delphi.net函数(eco编程) 软件技术
吕向阳 发表于 2009/3/15 11:07:17 |
ECO做网页时,运用到ASPX中调用DELPHI中的函数,其格式如下:
**
">产品一
其中(1)为调用的格式,其应该在外面的“”里面
(2)不要用,函数用=号
getid函数的功能,根据自己标定的文章的顺序号,取得其ECO的内生ID号,运用到一个服务:
IExternalIdService,这个服务的引用单元是borland.eco.Services,
具体实现如下:
function ttop.getid(sxh: integer): string;
var anews: news;
ies: IExternalIdService;
begin
result := '';
ehnews.Expression := 'news.allInstances->select(sxh=' + sxh.ToString.Trim + ')';
if ehnews.Element.GetAsCollection.Count > 0 then
begin
anews := ehnews.element.GetAsCollection()[0].asobject as news;
ies := EcoSpace.GetEcoService(typeof(IExternalIdService)) as IExternalIdService;
result := ies.IdForObject(anews.AsIObject());
end;
end;
|
|
[delpih编程]别人的一个小范例:delphi调用word 软件技术
吕向阳 发表于 2009/3/15 9:08:06 |
关于delphi自动生成word文档以及在文档中自动生成表格产生的问题
--------------------------------------------------------------------------------
id="Topic_"想把用StringGrid产生的表格内容,全部自动导入到一个新文档中,在word中自动
生成的表格中填充内容
由于StringGrid进行了表现形式的调整,合并了部分行、列
所以需要对word中的表格也要进行这些合并
现在有以下几个问题:
1、由于有多个StringGrid表格形式,所以需要对生成的word文档中加入多个表格,我希望每一
个表格都位于新开始的一页上,
就像在word中有个操作:“插入-》分隔符(下一页)”一样,在delphi中如何用代码控制?
2、自动生成的表格,需要合并单元格或者行、列,不知道怎么用delphi实现?
3、我希望在程序中点击按钮“导出文档”后,就自动弹出一个对话框,类似于windows的下载对
话框一样的,询问用户把这个文档存放在什么地方并可以自己取名字,而生成文档、插入表格、
填充内容等都是在后台完成的,用户看不见,不知道怎么做?我现在是调用word后,word被打开
后,自动生成了表格,然后往表格里面填充内容,所有的操作都是在前台可见的,这样用户会看
着word文档一直在闪烁,会看到表格的每一项内容顺序的填充下去,界面不是很友好。下面是我
用WordApplication和WordDocument控件写的代码:
try
WordApplication1.Connect;
except
Beep;
MessageDlg('不能生成文档,请确认是否安装了Word!',mtError,[mbOK],0);
Abort;
end;
//显示Word
WordApplication1.Visible:=true;//如果是自动存成文档,是否应该是false?
//给调用Add函数使用的实参赋值
Template:=EmptyParam;
NewTemplate:=False;
DocumentType:=wdNewBlankDocument;
Visible:=true;
DefaultTableBehavior:=true;
WordApplication1.Documents.Add(Template,NewTemplate,DocumentType,Visible);
//连接到新建的文档
itemIndex:=1;
WordDocument1.ConnectTo(WordApplication1.Documents.Item(itemIndex));
//文档另存为
WordDocument1.SaveAs(fileName);
withWordApplication1.Selectiondo
begin
Font.Size:=20;
Font.Bold:=2;
Paragraphs.Alignment:=wdAlignParagraphCenter;
TypeText('特性表');
TypeParagraph;//换行
//在指定文档中插入表格
Font.Size:=8;
Font.Bold:=1;
TypeParagraph;//换行
WordTable:=WordDocument1.Tables.Add(
WordApplication1.Selection.Range,
WordRows,
WordCols,
DefaultTableBehavior,
AutoFitBehavior);
end;
|
|
[delpih编程]Write your own PersistenceMapper component[放到这里备查] 软件技术
吕向阳 发表于 2009/3/14 19:29:41 |
Short tutorial on how to write your own database support with Eco II, Update 2
This tutorial is brief, and rather technical. If you are planning to use Eco
together with a database that is already supported (Interbase, MsSql, Oracle, Db2,
Informix, I would like to play the old Jedi trick on you...
Me: You don't need to see this information.
You: I don't need to see his information.
Me: This is not the information you are looking for.
You: This is not the information I'm looking for.
Me: You can go about your business.
You: I can go about my business.
Me: Move along
Shhhhhh... I'm just waiting for the standard users to slip away unnoticed, with a
blank stare... That old Jedi trick works every time
Now, the rest of you, I'm going to assume that you are either database vendors that
want to implement support for your own database, or that you are a die hard fans of
some database that you just can't live without and you have now discovered that you
can't live without Eco either. Welcome!
Eco is designed to support multiple database providers. Out of the box comes support
for Bdp and the native Microsoft SqlConnection. To write your own support for a
another database backend, there are couple of things you need to do:
Write your own PersistenceMapper component
Write your own implementation of the Eco IDatabase interface (and related
interfaces)
Write a set of AttirbuteMappers for the various datatypes that your database
supports
If the database architecture you are planning to support already has a Bdp provider
(but is not yet supported by Eco), you only need to do the last part above, and most
of the attribute mappers can be reused, but if you plan on supporting a new Ado.Net
provider, you will need to do all of the above.
The easiest way to do this is to copy/paste an existing implementation (that's what
I do myself when I add support for another database). Download the example for
MimerSql to use as a starting point. In your Eco source folder there is also the
source code for Bdp and SqlClient support.
Write your own PersistenceMapper component
Your new component should be a subclass of
Borland.Eco.Persistence.PersistenceMapperDb. In the Mimer example, look at the
PersistenceMapperMimer.cs for an example on how to subclass your own
PersistenceMapper.
Write your own implementation of the Eco IDatabase interface
Most of this work is done in the framework class AbstractIDatabaseImpl (and related
classes). In the Mimer example, please refer to the file MimerDatabaseImpl.cs for an
example on how to implement the required interfaces.
Parts of the code to do this is to make sure that the correct adapter is created for
queries and params. There are two methods that are metadata related that should be
implemented in order to support CreateDatabase and Evolve:
public override StringCollection AllTableNames(string pattern, bool systemTables)
public override DataTable GetIndexDefsForTable(string tableName)
The method AllTableNames should return a StringCollection with the names of the
table that exist in the database. The pattern parameter can be used to narrow the
search. If it is a non-empty string, only tables whose name matches the pattern
(contains the pattern as a substring) should be returned (Eco itself will only use
this to search for whole tablenames, never partial tablenames). If the systemTables
parameter is true, then system tables should be included in the result, otherwise
they should be ignored.
GetIndexDefsForTable should return a DataTable with the indices that are defined for
a table. The DataTable should contain columns called "ColumnName" and "IndexName"
and these columns should contain the obvious information... This information is used
by DbEvolution to drop any indices/foreign keys before dropping columns they refer
to. GetIndexDefsForTable is only required for DbEvolution. If you don't want to
support DbEvolution, you can return null/nil. The worst that can happen is that
DbEvolve fails if it tries to drop a column that has an index (if this is not
allowed by your database). For a sample implementat |
|
[delpih编程]asp.net中repeater控件做横向菜单方便控制 软件技术
吕向阳 发表于 2009/3/14 11:34:19 |
列表作横向菜单的CSS,当然一般用 '<div class=""> '<ul> '<li><li> '<li><li> '<li><li> .. '</ul> '</div> 这样做是没有一点问题的,问题是我用的是一个asp.net中repeater控件来做的, 常规做法出现的问题是不出现在一行上,并且高度不能控制。 此时 我用下面方法解决
主要改变做法:去掉<ul><li>相关标签,改为: CssClass="li" (asp.net对象) 或class="li"(html对象) ============ html代码: /*<div class="test"> (注:这里也没有用<ul></ul>) <a href="index.aspx" class="li">回主页</a> (注:这里没有用<li></li> <ASP:Repeater id="Repeater1" runat="server"> <itemtemplate> <asp:HyperLink CssClass="li" runat="server" navigateurl='<%# "typelist.aspx?RootId="+DataBinder.Eval(Container.DataItem ,"externalid") %>' target="_self"><%# DataBinder.Eval(Container.DataItem,"mc")%> </asp:HyperLink> </itemtemplate> </ASP:Repeater> <a href="newstypeadd.aspx" class="li">管理</a> </div>
*/ ============ css代码 /* .test ul{list-style:none;width:100%;background:#CCC;height:25px;} .test li{float:left;width:100px;background:#CCC;margin-left:0px;line-height:25px;}
.test a{font-size: 14px;float:left;width:100px;display:block;text-align:center;height:30px;} .test a:link{font-size: 14px;float:left;width:100px;color:#666;background:url(images\arrow_off.gif) #CCC no-repeat 5px 12px;text-decoration:none;} .test a:visited{font-size: 14px;float:left;width:100px;color:#666;text-decoration:underline;} .test a:hover{font-size: 14px;float:left;width:100px;color:#FFF; font-weight:bold;text-decoration:none;background:url(images\arrow_on.gif) #F00 no-repeat 5px 12px;} .test a:active{font-size: 14px;float:left;width:100px;color:#FFF; font-weight:bold;text-decoration:none;background:url(images\arrow_on.gif) #F00 no-repeat 5px 12px;} */ ========
|
|
[delpih编程]bds2006中调试问题 软件技术
吕向阳 发表于 2009/3/13 19:44:15 |
BDS2006中我利用ECO做一个BLOG系统,发现利用CSS样式表时,在dreamweaver中预览显示均正
常,但原版放入到BDS2006中时,发现涉及到浮动的部分均不生效。经过反复调试,最后证明是
注释语句在BDS2006中作为了不正常的处理,只要将全部注释去掉都正常了,在其他地方加上注
释,则加了的又不正常了。
备忘!
|
|
|