找回密码
 立即注册

QQ登录

只需一步,快速开始

ninja_aya

中级会员

54

主题

197

帖子

561

积分

中级会员

积分
561

活字格认证

ninja_aya
中级会员   /  发表于:2014-11-10 17:07  /   查看:5896  /  回复:5
1、第一个功能是按照段落划分,将A文档中的部分段落拷贝到B文档中,要求文字和样式一致
目前想到两个方法,一个是for循环A文档中的段落,当这个段落符合拷贝要求时,调用textcontrol1.copy(),然后textcontrol2.paste()
但是这样写好像没什么用,复制拷贝没效果,请问代码需要怎么写?
第二个方法是我for循环A文档中的段落,然后textcontrol2.selection.text=段落.text,然后将段落的所有样式都复制到textcontrol2当前段落中。s1.Baseline = s2.Baseline;
            s1.Bold = s2.Bold;
            s1.FontName = s2.FontName;
            s1.FontSize = s2.FontSize;
            s1.ForeColor = s2.ForeColor;
            //s1.FormattingStyle = s2.FormattingStyle;
            s1.Italic = s2.Italic;
            s1.TextBackColor = s2.TextBackColor;
            s1.Underline = s2.Underline;
            s1.ParagraphFormat.AbsoluteLineSpacing = s2.ParagraphFormat.AbsoluteLineSpacing;
            s1.ParagraphFormat.Alignment = s2.ParagraphFormat.Alignment;
            s1.ParagraphFormat.BottomDistance = s2.ParagraphFormat.BottomDistance;
            s1.ParagraphFormat.KeepLinesTogether = s2.ParagraphFormat.KeepLinesTogether;
            s1.ParagraphFormat.KeepWithNext = s2.ParagraphFormat.KeepWithNext;
            s1.ParagraphFormat.LeftIndent = s2.ParagraphFormat.LeftIndent;
            s1.ParagraphFormat.LineSpacing = s2.ParagraphFormat.LineSpacing;
            s1.ParagraphFormat.PageBreakBefore = s2.ParagraphFormat.PageBreakBefore;
            s1.ParagraphFormat.RightIndent = s2.ParagraphFormat.RightIndent;
这个方法感觉代码看上去很繁琐,请问有什么好方法吗?要求效率比较高的

2.请问下你们有没有txtextcontrol网页版本的控件,要求能实现用户在网页上就能编辑.tx文件并保存到服务器。

5 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2014-11-10 18:19:00
沙发
回复 1楼ninja_aya的帖子

请问你是不是使用的WinForm平台下的Tx Text Control?
1.这个问题我需要测试下才能给你准确的答复,还望理解。
2.根据技术平台的不同,TX Text Control 产品分为 .NET for Windows Forms、.NET Server for Windows Forms、.NET for WPF、.NET Server for WPF、ActiveX、ActiveX Server等六个产品。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
ninja_aya
中级会员   /  发表于:2014-11-10 20:09:00
板凳
那你说的这六个产品里面哪个能满足我第二个功能呢?
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-11-11 10:28:00
地板
回复 3楼ninja_aya的帖子

有两种:
使用Tx TextControl for Windows Forms,创建所见即所得的BS程序。把文档加载到网页,你可以参考下博客:
http://blog.gcpowertools.com.cn/ ... tx_win_WYSIWYG.aspx

使用.Net Server for ASP.NET,基于Html5的WebEditor的在线Demo:
http://txlabseu.cloudapp.net/simple/index.aspx#
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
ninja_aya
中级会员   /  发表于:2014-11-12 10:34:00
5#
请问下,那个copy和paste有实现吗?
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-11-12 11:32:00
6#
回复 5楼ninja_aya的帖子

textControl.Copy和textControl.Paste是指对Current选择进行复制和粘贴。
所以如果使用这个方法,需要先进行选择,然后在复制和粘贴:
举个例子来说,复制全部,比如:
  1. txControl.Focus();
  2. txControl.SelectAll();
  3. txControl.Copy();
  4. txControl.Select(0, 0);
复制代码


如果你需要格式的复制粘贴,建议使用SaveToMemory 和LoadFromMemory 方法。 SaveToMemory 复制内容和格式到the memory。
再举个例子说明:

  1. byte[] data;
  2. data = TXTextControl1.SaveToMemory(3, false);
  3. TXTextControl2.LoadFromMemory(data, 3, false);
复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部