here i created sequence no. with every paragraph line
..
like...
<p local_id = P-100>aaaaaaaaaaa aaaaaaaaaaaaaa< \p>
<p local_id = P-101>bbbbbbbbbbb bbbbbbbbbbbbbb< \p>
<p local_id = P-102>vvvvvvvvvvv vvvvv<\p>
and show in richtextbox control..
here is my code:- - private void button1_Click(object sender, EventArgs e)
-
{
-
try
-
{
-
OpenFileDialog ofd = new OpenFileDialog();
-
//Font fonttext = null;
-
-
ofd.DefaultExt = "*rtf";
-
ofd.Filter = "RTF File|*.rtf";
-
ofd.ShowDialog();
-
textBox1.Text = ofd.FileName.ToString();
-
filepath = ofd.FileName.ToString();
-
-
//FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
-
//StreamReader sr = new StreamReader(fs);
-
-
richTextBox1.LoadFile(filepath,RichTextBoxStreamType.RichText);
-
string inputstring = richTextBox1.Text;
-
StringBuilder sb = new StringBuilder(inputstring);
-
//Font fonttext = new Font(sb);
-
-
//if (fonttext.Bold)
-
//sb.Append(@"<B>");
-
-
//string xx = inputstring;
-
//string yy = xx.Replace("", "");
-
////if (fonttext.Bold)
-
//// sb.Insert(0, "<B>");
-
////else if
-
//// (fonttext.Italic)
-
//// sb.Insert(0, "<I>");
-
////else
-
-
sb.Insert(0, "<p>");
-
//string yy = xx.Replace("", "");
-
//sb.Replace("<p>", "");
-
//int num = 0;
-
// sb.Replace("<p>"
-
-
sb.Replace("\n", "</p>" + "\n" + "<p>");
-
sb.Replace("<p>" + "</p>", "");
-
sb.Append("</p>");
-
sb.Replace("<p>" + "</p>", "");
-
sb.Replace("\n\n", "\n");
-
sb.Replace("\n\n", "\n");
-
sb.Replace("\n\n", "\n");
-
sb.Replace("\n\n", "\n");
-
sb.Replace("\n\n", "\n");
-
sb.Replace("\n\n", "\n");
-
int p=0;
-
string xx = sb.ToString ();
-
int ppara = 0;
-
ppara = xx.IndexOf("<p>", 0);
-
while (ppara!= -1)
-
{
-
p = p+1;
-
////string f1 = Convert.ToString(p);
-
//f1.ToString().PadLeft(8);
-
xx = xx.Remove(ppara, 3);
-
//if (fonttext.Bold)
-
// xx = xx.Insert(ppara, "<p local-id=\"B-" + p + "\">");
-
//else
-
xx = xx.Insert(ppara, "<p local-id=\"p-" + p + "\">");
-
ppara = xx.IndexOf("<p>", ppara+3);
-
}
-
-
richTextBox1.Text = xx.ToString();
-
-
}
-
//}
-
catch (Exception ex)
-
{
-
MessageBox.Show(ex.Message);
-
}
-
}
problem is that, if there is any bold,italic paragraph.then he show output in richtextbox like...
<p local-id=\"p-" + p + "\">">wwwwwwwww wwwww<\p>
<B local-id=\"B-" + p + "\">">aaaaaaaaa aaaa<\B>
<I local-id=\"I-" + p + "\">">yyyyyyyyy yyyyy<\I>
then how??
0 2874 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Imaya Kumar |
last post by:
Hi,
i'm developing an editor in VS.NET using Rich Text Box
Control. I need to make a selected text Bold. how can i do
this? also i will have an Italic Button too. If i click
Bold button the selected text has to become bold, and if i
click italic button, the bolded text has to become Italic
too with the bolded attribute. how can i do this? help me..
thanks
imaya kumar
|
by: Ronny sigo |
last post by:
Hello all,
I have made a form with a lot of entryfields and one button which, when
clicked on, transforms all of the entryfields values into a MS Word
document.
All the formatting is done programatically and all works well, except for
one thing:
I don't seem to be able to make a paragraph apear in bold.
I have tried: Selection.Font.Bold = wdToggle ' does not work
I have tried: Selection.Font.Weight = 700 ' does not work
I have tried:...
|
by: Adam Honek |
last post by:
Okay,
Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.ShowDialog()
txtEmailBody.SelectionFont = FontDialog1.Font
But how does one change the selected text to bold, italic or underlined
without using the font dialog?
|
by: andreas |
last post by:
When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response
|
by: paraidy |
last post by:
Hi, i'm using a richtextbox named r1, and i want to write in Bold and
italic, i tryed this for bold and it work
Dim f As New Font("Verdana", 30, FontStyle.Bold)
r1.Font = f
r1.Text = "Hello"
but if i try this for bold and italic it doesn't work
Dim f As New Font("Verdana", 30, FontStyle.Bold And FontStyle.Italic)
| |
by: fidtz |
last post by:
Sorry for asking here, but I don't know enough dotnet or Windows
programming yet to be very good at googling for answers. OTOH, this is
the first question I haven't be able to resolve myself, the
documentations is excellent.
This code looks to me like it should swap the bold highlight around,
but Regular never gets reapplied, leaving both labels in Bold.
Maybe there is a better way of doing this (aside from the obvious
refactor), but...
|
by: Tor Inge Rislaa |
last post by:
Finding Bold Text (or other formatting attributes) in RichTextbox .
Is it possible to find and select bold text by code within the text of a
RichTextbox? What I want is to manipulate the text into HTML code. Replace
the Bold text with <b>This is the bold text</bbefore I save it to an HTML
file.
|
by: sudhivns |
last post by:
Hi,
following is the part of my xml file.
data.xml
<Value>
This is normal text
This has to be printed in bold.
This has to be printed in Italic.
This has to be printed in bold/italic.
|
by: gmcconville |
last post by:
Im a little bit stuck on how to change a cell in a datagridview to bold without affecting any of the other attributes of the cell, such as underline, italic etc.
This is what I thought would work but doesn't
foreach (DataGridViewCell cell in grid.SelectedCells)
{
cell.Style.Font = new Font(cell.Style.Font, FontStyle.Bold);
}
This does change it to bold but takes out italics and underline.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |