Go Back   TX Text Control Community > TX Text Control Discussion and Support Forums > TX Text Control .NET Server

TX Text Control .NET Server Please use this forum for TX Text Control .NET Server support only. If you need support for a different product, please use the appropriate forum.

Reply
 
Thread Tools Display Modes
  #1  
Old February 26, 2010
MasterOfPandas MasterOfPandas is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Multiple document merge : AccessViolationException

Hi,

First, sorry for my bad english , i'm french. I post because i have problem with merging multiple document. When i add documents to ServerTextControl.Selection, i catch an AccessViolationException.


code :

Code:
WordFile word = new WordFile(new ServerTextControl());
            word.stc.Create();
            foreach (String path in pathList)
            {
                word.stc.Selection.Load(path, GetFormat(path));
                if (word == null)
                {
                    word = LoadFile(path);
                }
                else
                {
                    word.stc.Selection.Load(path, GetFormat(path));
                }
                File.Delete(path); // on supprime les fichiers temporaires crées
            }
WordFile Class just encapsulates (not sur of this word...) the ServerTextControl. When i add the new document to the current one, .Net throw a AccessViolationException, "you are trying to access not allowed memory" or something like this.

Process : In this application, users can check documents and download a merged document resulting of the merging of selected documents.

So multiple documents merging does not working, whereas single generation is working.

I don't know how i can fix this. I hope i was clear and understandable.

Thanks
Reply With Quote
  #2  
Old March 1, 2010
Gunnar Giffey's Avatar
Gunnar Giffey Gunnar Giffey is offline
TX Support Engineer
TX Text Control
 
Join Date: Sep 2004
Location: Bremen, Germany
Posts: 3,999
Re: Multiple document merge : AccessViolationException

Hello there,
Do you want to append or insert a document?
To append a document, please test the Append method.
__________________
Regards,
Gunnar Giffey, TX Text Control
[Forum Administrator]
Reply With Quote
  #3  
Old March 8, 2010
MasterOfPandas MasterOfPandas is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Re: Multiple document merge : AccessViolationException

Hello, thanks for reply.


I want to append one or several documents to a single one. I try to use the "Append Method", but with the same results...


I believe i'm using the same methods which is described in documentation.


Quote:
Step 6: Merge Multiple Documents
This sample shows how to append several documents to TX Text Control .NET Server. The Load method can be used to load a document which replaces the current document in TX Text Control .NET Server. If a document should be appended or should replace the current Selection, the Selection.Load method must be used.

In this sample, 3 different documents will be loaded and saved as one merged document. The following loop loads all documents whose filenames are stored in an array list:
Code:
[C#]
foreach(string document in mergeDocs)
{
  TXTextControl.StreamType streamType = new TXTextControl.StreamType();
  if (document.EndsWith("doc"))
    streamType = TXTextControl.StreamType.MSWord;
  else if (document.EndsWith("rtf"))
    streamType = TXTextControl.StreamType.RichTextFormat;
  else if (document.EndsWith("htm"))
    streamType = TXTextControl.StreamType.HTMLFormat;
  try
  {
    serverTextControl1.Selection.Load(Server.MapPath(document), streamType);
  }
  catch(Exception ex)
  {
    Response.Write("<font color=red><b>An error has occurred:</b><br>");
    Response.Write(ex.ToString() + "</font>");
    return;
  }
  counter++;
  if(CheckBox1.Checked == true &&A counter != mergeDocs.Count)
  {
    serverTextControl1.Selection.Text = "\n\f\n";
  }
}
Reply With Quote
  #4  
Old March 10, 2010
Gunnar Giffey's Avatar
Gunnar Giffey Gunnar Giffey is offline
TX Support Engineer
TX Text Control
 
Join Date: Sep 2004
Location: Bremen, Germany
Posts: 3,999
Re: Multiple document merge : AccessViolationException

I do not see the Append method in your code.
Which version are you currently using?
Also, do you see any chance to reproduce your issue outside of your main project in another simple sample?
__________________
Regards,
Gunnar Giffey, TX Text Control
[Forum Administrator]
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging Multiple Documents into One Document brycare TX Text Control .NET Server 3 February 15, 2010 15:10:43
Multiple Trays and Merge Field Switches Optima TX Text Control .NET Server 0 October 7, 2008 08:48:35
Merge Fields in HTML document Max TX Text Control ActiveX 2 April 22, 2004 03:12:55
Mail Mergeing Multiple Records in one Document stephenk TX Text Control .NET 3 February 3, 2004 01:24:43
multiple image in pdf document softedave TX Text Control .NET 0 March 3, 2003 14:44:10


All times are GMT +1. The time now is 06:20:10.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 1991 - 2010 The Imaging Source Europe GmbH