Stream theStream = FileUpload1.PostedFile.InputStream;
int
size = Convert.ToInt32(FileUpload1.PostedFile.InputStream.Length + 1);
Byte[] rtf =
new
Byte[FileUpload1.PostedFile.InputStream.Length+1];
theStream.Read(rtf, 0, size);
string
s = System.Text.Encoding.Default.GetString(rtf);
RadEditor1.LoadRtfContent(s);
when i try to import a rtf file and load it i get the following error,,
a text cannot appear on root level, must be child of a group: ''
pls help me out ..
Warm Regards
Gokoulane Ravi
TTCPL
8 Answers, 1 is accepted
You can load a RTF file as a string using this code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
FileStream fileStream = new FileStream(Server.MapPath("RtfEditor.rtf"), FileMode.Open, FileAccess.Read);
RadEditor1.LoadRtfContent(fileStream);
}
}
A sample project working project which demonstrates the above functionality is attached here.
You can find information on the RadEdiotr's export to rtf functionality in the following online demo: http://demos.telerik.com/aspnet-ajax/editor/examples/rtfexport/defaultcs.aspx.
When it comes to loading rtf content in the control you can use the LoadRtfContent method. There are two overloads of it:
- LoadRtfContent(Stream rtfStream)
- LoadRtfContent(String rtfText)
Kind regards,
Rumen
the Telerik team
rtfstring=
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\b\f0\fs20 Final Exam for CSM2020 - WORK AND TEST PERMITS \par \par Exam Number: 4141 \par \par \par 1) \{5 points\} \cf1\b0 A directive issued to perform specified operations on electrical equipment is a \par \par A) Operating Order \par B) Work Permit \par C) Dielectric System Order \par D) Test Permit\b \par \par 2) \{5 points\} \b0 When it is necessary to extend the scope of the work for which a permit is granted it will be necessary to \par \par A) transfer the permit \par B) suspend the permit \par C) table the permit \par D) recall the permit\b \par \par 3) \{5 points\} \b0 Hard hats and rubber gloves are examples of \par \par A) Safety equipment \par B) Personal protective equipment \par C) Rain gear \par D) Switching equipment\b \par \par 4) \{5 points\} \b0 Which of the following is not a category of work permit ? \par \
par A) Electrical Permit \par B) Dielectric Permit \par C) Mechanical Permit \par D) Area Permit\b \par \par 5) \{5 points\} \b0 Which of the following is not an example of "isolation for dead work" \par \par A) An open and blocked disconnect switch \par B) The pothead link removed in a 13kv cubicle \par C) An open and blocked breaker \par D) A bus link removed\b \par \par 6) \{5 points\} \b0 A method used for prompt issuance of a work permit is \par \par A) Write the work permitout before contacting the D.O. \par B) Re-issue tabled permits \par C) Pre- Issue work permits \par D) Limit the number of work permits issued\b \par \par 7) \{5 points\} \b0 When the work to be done is not completed but the equipment can be restored to service the work permit should be \par \par A) transferred \par B) tabled \par C) suspended \par D) recalled\b \par \par 8) \{5 points\} \b0 Atmospheric hazards are a concern when working in \par \par A) Outdoor areas \par B) Open areas \par C)
Control rooms \par D) Confined spaces\b \par \par 9) \{5 points\} \b0 When more then one working group requires a permit on the same equipment who can coordinates the work ? \par \par A) District Operator \par B) Station Operator \par C) Shift Manager \par D) Working Group Supervisor(s)\b \par \par 10) \{5 points\} \b0 When work is extended from one watch period to another and the work permit will be returned by a person other then the one to whom it was issued, it will be necessary to \par \par A) suspend the permit \par B) transfer the permit \par C) recall the permit \par D) table the permit\b \par \par 11) \{5 points\} \b0 A "Time Out" may be declared by \par \par A) the Shift Manager \par B) the work permit holder \par C) the District Operator \par D) anyone\b \par \par 12) \{5 points\} \b0 What is the minimum protection required for work on the Dielectric System ? \par \par A) One open and taged valve \par B) Two closed and taged valves in series \par C) One clo
sed and taged valve \par D) Two open and taged valves in series\b \par \par 13) \{5 points\} \b0 Who is responsible for ensuring that the required protection has been applied before issuing a work permit ? \par \par A) Operator having Jurisdiction \par B) Shift Manager on duty \par C) Area supervisor \par D) Working crew supervisor\b \par \par 14) \{5 points\} \b0 Who is ultimately responsible for events in a substation ? \par \par A) Substation Shift Manager \par B) Senior System Operator \par C) Substation Operator \par D) District Operator\b \par \par 15) \{5 points\} \b0 When equipment is in immanent danger of failure and poses an immediate threat to people and/or equipment this is a \par \par A) Category 1 Emergency \par B) Class 4 Emergency \par C) Category 2 Emergency \par D) Category 3 Emergency\b \par \par 16) \{5 points\} \b0 Whe is most likely to receive a Test Permit \par \par A) Field Operator \par B) Station Operator \par C) Mechanic "A" \par D) PST Techni
cian\b \par \par 17) \{5 points\} \b0 Permission granted to a person to perform specific work on specific electrical equipment is a \par \par A) Work Permit \par B) Dielectric System Order \par C) Operating Order \par D) Test Permit\b \par \par 18) \{5 points\} \b0 Which of the following is not an example of "grounded for dead work" \par \par A) A closed and blocked G&T device \par B) a set of static grounds \par C) A set of approved portable grounds connected to the station ground \par D) A station ground closed and blocked\b \par \par 19) \{5 points\} \b0 If the work will not be completed on time the permit holder must notify the \par \par A) District Operator \par B) Area Supervisor \par C) Station Operator \par D) Shift Manager\b \par \par 20) \{5 points\} \b0 The purpose of the rulebook is to provide guidance for \par \par A) Safe operation of the electrical system. \par B) Proper conduct in a substation \par C) Writing operating orders \par D) Writing procedures\cf
0\fs17 \par }
Code:
RadEditor1.LoadRtfContent(rtfstring)
Regards,
Mukesh
Thank you for reporting this bug.
This is limitation of the third party Import from RTF to HTML library that RadEditor uses. We examined and fixed the problem. It will not exist in the next latest internal build of RadControls for ASP.NET AJAX.
Kind regards,
Rumen
the Telerik team
At present, a fix for this issue is not available for download. The next latest internal build including this fix will be available for download before the end of the business week.
Kind regards,
Dobromir
the Telerik team
Thank you.
The fix for this problem was not released in the latest version of RadControls for ASP.NET AJAX (Q3 2010), because it was causing some other issues. Currently we are working on this problem and will do our best to have it fixed as soon as possible. Unfortunately, I am unable to provide a firm estimate for its release.
In addition, could you please provide a sample content reproducing this problem to help us handle all the scenarios causing it?
Please excuse us for the inconvenience.
Regards,
Dobromir
the Telerik team