.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

rich text box and printing

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Windows Application

Hi all,

My windows form uses a rich text box. The contents of which are populated from a database. Auto wrap is set to true.

My application let's people print labels and preview it first (not using the print dialog preview, but I have created a panel which lays all out. This is so they can alter the content if needed).

The issue I have is: when the user clicks the preview button the text in the rich text box wraps and all is as should be. However, when it prints, it doesn't wrap.

 string sDesc = rtxtDesc.Text; <br/>
 string[] aDesc = sDesc.Split(Environment.NewLine);
      foreach (string sLine in aDesc)
You can see what I was trying to do (althought C# doesn't like this)

I am using a string writer and a string builder to send the information to the printer.

Any ideas?



View Complete Post

More Related Resource Links

rich text editor



I need to implement one text editor in my application. I dont need a complex one, i just need a simple one.

please help me


Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

Javascript error on Rich Text Editor of CEWP

Hi all,

I have a problem that is really bugging and I wasn't able to find any workaround all day. I'll try to give as many details as possible:

I'm maintaining several site collections on a single server and this problem occurs only on one of the site collections. However it occurs on all subsites of this collection, it occurs on old pages and newly created pages, even on pages containing only one empty CEWP.

When I'm pressing the button for Rich Text Editor of CEWP I get the following error:

Message: Invalid argument.
Line: 5740
Char: 2
Code: 0
URI: http://www.dyrlaegeankenaevn.dk/_layouts/1030/HtmlEditor.js

I've tracked down the error with IE developer tools and I found that the error pops up in HtmlEditor.js at

function RTE2_GenerateLaunchArguments(parameterArray, webUrl, containerID)
    ............some code goes here......................
    ............some code goes here......................

I followed containerID down the stack and it comes from:

Rich text sql 2005

Hi I want rich text to be displayed on SSRS report in SQL 2005. That text is stored in database in html format from html editor textbox in frontend. Please help!! Thanks in Advance

Remove Word Style once copy and paste content to Rich text Editor in sharepoint 2010

Hi Guys, I have page layout for Users to add content for Page.I have site column for page content on field type HTML with Richtextmode="FUll Html". Now when user cut and paste content from Word document in this Field it carry word document style. how can i control this content on Page layout with CSS. Please adviseThanks Ron

Rich text field showing html code

I am an end user of Sharepoint. This issue only happens from my computer, not from any other within our organization. What happens is that when I edit an item in Sharepoint that contains a rich text field, HTML code is showing. Like so: <div class=ExternalClassC900CFF4F2BF4312A89133C01A6E3C96> Some text</div> This happens from any web browser. Sharepoint 2007 is used. I have Windows 7 x64. Any idea what is causing this?

Query Sharepoint list, rich text columns returning HTML tags

Hi! So I have an issue that maybe someone of you have encountered as well. I am querying a Sharepoint list and creating a report from the data collected from this list. This all works fine except that one of the columns in this list is of the type "Multiple lines of text" and also supports "rich text" with different fonts, sizes and so on. This has the effect that the text returned from this column is wrapped in HTML tags that specifies how the text should be formatted. Naturally I do not want this HTML code to appear in my report so for now I have used custom code to do a string.replace and replaced for example <div></div> and <br> with "". However, this column also has url references to documents and these links shows up like this "/servername/site/subsite/Gemensamma%20dokument/Mwh.docx">http://servername/site/subsite/Gemensamma%20dokument/Mwh.docx There is some sort of double reference to the document that I guess like the HTML tags are embedded in the answer from the rich text column and this is not so easy to do a string replace on because the url varies with the different document and document names. My question really is if anyone of you have done a similar report that I am doing, and have encountered this fenomen with this sharepoint column and how you did to solve this? I have tried to creat

How to modify Rich Text Editor Tool Bar

Besides using jQuery, is there an easy way to remove buttons such as 'Bold' and 'Italic' from the RTE tool bar? How about the buttons in the Rich Content Editor web part?

SharePoint 2010 Rich Text Editor field

I want to embed iframe tag in Sharepoint 2010 rich html text editor control, but it is simply remove the tags when i save the content. Please let me know how can i do this?

Rich Text in list forms & date picker

Hi, I was hoping that someone could help me on a few issues. I have created a custom list form in sharepoint designer to display the contents of my list in a nice format. I have also customised the edit form for the list. I am having a problem with special characters now showing up when they are being entered (the HTML does not seem to be parsed on the output). I would like to make a description field in my list edit form a rich text box, is this possible? This is the code I am using at the moment for the text box: <asp:TextBox runat="server" id="ff5{$Pos}" text="{@status}" textmode="multiline" __designer:bind="{ddwrt:DataBind('u',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@status')}" Width="600px" Height="100px" /> And this is the code that I am using on the display side of the list to show the status update: <xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@status))" /> Is there code that I can use on the data entry side that will show a rich text box? Also then I will need to change the tag on the display end so it parses the HTML? In addition to this, is there specific code for a 'date picker' ? At the moment my date entry box is just a standard text box, is there code I can u

RDLC reports with Rich text support

Hi, I am looking for the solution to display the Rich text in RDLC file with local processing mode. I have read from the following link which stated that Microsoft made this feature available in Visual Studio 2010. http://blogs.msdn.com/b/brianhartman/archive/2010/04/20/visual-studio-2010-is-now-available.aspx Can anyone please tell me how to use this? Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

how to print rich textBox Formatted text

Hi,  I have some text in rich text box format in a table.The data is like  {\rtf1\ansi\ansicpg1252\deff0\deflang16393{\fonttbl{\f0\fnil\fcharset0 NSimSun;}{\f1\fnil\fcharset0 Microsoft Tai Le;}{\f2\fnil\fcharset0 MingLiU_HKSCS;}{\f3\fnil\fcharset0 Palace Script MT;}{\f4\fnil\fcharset0 Microsoft Sans Serif;}} {\colortbl ;\red0\green192\blue0;} \viewkind4\uc1\pard\cf1\b\f0\fs44 hello hi\par \lang1033\f1 hi i am fine\par \f2 about u?\lang16393\b0\i\f3\par \par \par \cf0\i0\f4\fs17\par }  Now,I want to print the data in corresponding format.can u please Help me.....

.mdb and C# form question for a Rich Text Box

Ok heres my question. I have a program that i am writing that uses a .mdb database file. All the fields are set to Memo in the database for the size. My problem is i have a Rich Text Box that is used to gather info before it gets saved to the .mdb file. I narrowed it down to a maximum size problem with the RTB. Is there any way to increase the maximum data size of the RTB so that saving more then 3 sentences won't crash the program and will actually save the 3 sentences +. ?  Or is there some trick to get around that that i am not getting at the moment? So to restate my problem. I can't save anything over roughly 3 sentences from my C# form to a .mdb file without the program kicking out an exception, And the .mdb fields are already set to Memo. Thanks for any help/input in advance. This has been bugging me for a while and i haven't found anything online yet but i will keep searching.

Reading WPF rich text box content in HTML format

Hi, I am using WPF RichTextBox. From that, I am reading the content in RTF format using the following code. TextRange textRange = new TextRange(paramRichTextBox.Document.ContentStart, paramRichTextBox.Document.ContentEnd); MemoryStream msData = new MemoryStream(); textRange.Save(msData, DataFormats.Rtf); //get the data from the selected range //strData = textRange.Text; strData = ASCIIEncoding.Default.GetString(msData.ToArray()); I also found that there is an option called DataFormats.HTML. Hence, I tried using this but ended up with error. Is there any other way to read the content of RichTextBox in HTML format? Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

Displaying Rich text with formatting in RDLC file

Hi, I want to display my rich text with formatting in RDLC file. Can anyone please help me with the way out for that? Thanks & Regards, Subalakshmi Vijayarajan.

Problem in Rich Text box

Hi,     When i run this code, i am getting "Stack overflow Exception", Please any one correct this bug. Description:       My intention is i want to display red color for commented line. Example: Create Procedure SP_Accounts_Details    --Accounts  (     @in_target_source_inst INTEGER, --4855 )      Window.xaml <Window x:Class="RichTextBoxSample.Window1"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   Title="Window1" Height="500" Width="1200">     <Grid>     <RichTextBox Height="436" Margin="12,64,-22,-38" Name="richTextBox1" Width="1188" TextChanged="richTextBox1_TextChanged"/>     <Button Height="23" HorizontalAlignment="Left" Margin="270,35,0,0" Name="btnClick" VerticalAlignment="Top" Width="75">Button</Button></Grid></Window> Window1.xaml using   System; using   System.Collections.Generic; using   System.Linq; using   System.Text; using   System.Windows; using   System.Win

Rich Text Editing in Firefox


Hey all,

I'm using an InputFormTextBox to ask a user to input text, it only displays bold/italic/fancy options in IE though! I thought this had been approached for Sharepoint 2010, is there a way I can get this rich text control to display in all browsers (firefox/chrome) rather than defaulting back to the HTML view?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend