ninja_aya 发表于 2014-6-23 15:35:00

TextControl能否在宿祖在winform界面下加载文档

原先加载文档,是在winform下,创建TextControl,然后调用TextControl textControl =new TextControl();textControl.load(path);现在打算在无界面情况下使用TextControl 加载一份tx格式的文档,但是报出The TXTextControl object must have been completely loaded to use this method.
请问有什么解决方案吗?
我是打算编写一个dll类库,然后里面专门用TextControl编写一些解析的方法,解析出里面的域的值,提供其他程序调用。

iceman 发表于 2014-6-23 18:09:00

回复 1楼ninja_aya的帖子

问题我已经重现了,通过以下方法能否解决你的问题?

      private void button1_Click(object sender, EventArgs e)
      {
            TXTextControl.TextControl tc = new TXTextControl.TextControl();
            this.Controls.Add(tc);
            tc.Visible = false;
            tc.Load("test.tx", TXTextControl.StreamType.InternalFormat);
      }

ninja_aya 发表于 2014-6-23 21:29:00

不是 我的意思是没有任何界面的,就是在一个类里面加载文档,然后解析文档,没有任何界面宿主

iceman 发表于 2014-6-24 17:48:00

回复 3楼ninja_aya的帖子

恩,我理解你的需求了,不过我在license校验遇到了问题,我已经把问题反馈给了厂商,预计明后天收到进一步反馈。
当前我的测试代码如下:

            TXTextControl.TextControl tc = new TXTextControl.TextControl();
            tc.CreateControl();
            tc.Load("test.tx", TXTextControl.StreamType.InternalFormat);

ninja_aya 发表于 2014-6-24 21:15:00

谢谢

iceman 发表于 2014-6-25 09:45:00

回复 5楼ninja_aya的帖子

你好,

如果在没有 UI 情况下需要使用 ServerTextControl 进行文档处理。
测试代码如下:

      static void Main(string[] args)
      {
            TXTextControl.TextControl tc = new TXTextControl.TextControl();
            tc.CreateControl();
            tc.Load("test.tx", TXTextControl.StreamType.InternalFormat);
      }


需要注意的是添加license文件(可以通过添加 Windows Form 窗体添加 ServerTextControl 添加),附件是测试Demo:

iceman 发表于 2014-6-26 16:01:00

回复 5楼ninja_aya的帖子

这篇博客中有详细的使用方法:http://blog.gcpowertools.com.cn/post/2014/06/26/nonUI-servertextcontrol.aspx

indigodai 发表于 2014-7-10 08:55:00

回复 6楼iceman的帖子

我试了,当在Visual Studio里运行是成功的。
但是当把程序部署到IIS里,运行就会提示错误 “This feature is not available. The TX Text Control Server version must be installed.”
这个是什么原因?

iceman 发表于 2014-7-10 09:53:00

回复 8楼indigodai的帖子

帮助文档中有两个章节讲述了部署 ServerTextControl,请你先参考下:
Distributing a TX Text Control .NET Server Project
Redistributable Files

着重看下你是否部署了相应的 DLL,例如:TXTextControl.Server.dll (20.0.500.500)

或者可以把你的测试工程发上来,我们尝试部署下。

ninja_aya 发表于 2014-7-22 21:50:00

我这里报
The TXTextControl object must have been completely loaded to use this method。

TXTextControl.ServerTextControl tc = new TXTextControl.ServerTextControl();
                                                tc.Load(projectFiles, TXTextControl.StreamType.InternalUnicodeFormat);
                     
                        foreach (TXTextControl.IFormattedText textPart in tc.TextParts)
                        {
}
页: [1] 2
查看完整版本: TextControl能否在宿祖在winform界面下加载文档