Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
« »

Loading the clipboard content into TX Text Control

Blogged by Björn Meyer on September 12, 2007 and tagged with Samples.

If you copy and paste text from MS Word into TX Text Control, it is inserted as RTF formatted text. If you select and copy a complete document in MS Word and paste it into TX Text Control, the page size and margins are not adapted automatically.

TX Text Control's approach is to keep the existing page size and to insert the formatted text into this pre-defined page. Anyway, sometimes it is required to adapt the page size and margins as well. In this case, it is possible to use the Load method of TX Text Control to insert the clipboard's content into TX Text Control. Using the LoadSettings, the page size and margins can be adjusted after loading the document.

string data = (string)Clipboard.GetData(DataFormats.Rtf);
TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
textControl1.Load(data, TXTextControl.StringStreamType.RichTextFormat, ls);
textControl1.PageSize = ls.PageSize;
textControl1.PageMargins = ls.PageMargins;
« Prev:Setting the zoom factor using the mouse wheel
» Next:ASP.NET: Getting the client's .NET version

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place