Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
we are displaying word document in label ,but it is displaying like without line break or not in format.
I want to display word file in label with text format i.e line by line format
Posted

A label does not understand text formatting and as a result you cannot display a word file in text.
You can use the Word inter-op to embed a word doc in your code.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-May-11 12:03pm    
Correct. You can only use plain text for a label (but the way, what a bad idea to use label! Does OP no other controls like RichTextBox?). My 5.
--SA
Abhinav S 23-May-11 12:06pm    
Yes. OP should be using something more format friendly (than a label). Thanks for the 5.
Sergey Alexandrovich Kryukov 23-May-11 12:04pm    
So, I added my advice, please see.
--SA
Abhinav S 23-May-11 12:06pm    
Yes. Just read it.
Wonde Tadesse 23-May-11 22:54pm    
Please see my soln
Well, as it has been said label control is not the right control to display word document file on web application. So to view or edit word document over on web application,you may have to use Editor control. You can try RTE (Rich Text Editor) ASP.NET Control[^], else you have to go with commercial once,RadEditor for ASP.NET AJAX[^]

I hope this helps you well.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 23-May-11 22:58pm    
Yes, those are good ideas, a 5.
--SA
Wonde Tadesse 30-May-11 8:42am    
Thanks
Abhinav S 30-May-11 6:49am    
Yes using a third party option would be good. 5.
Wonde Tadesse 30-May-11 8:42am    
Thanks
Strange idea to use Label control and loose all formatting. Consider RichTextBox; you can make it read-only if you want.

[EDIT]
I did not noticed the question is Web application, where RichTextBox is not available. A Word file could be translated into (almost) equivalent HTML code. In most cases, adequate translation is possible (almost) without losses in formatting. If Word formatting is not needed, using Word is pointless.

—SA
 
Share this answer
 
v2
Comments
Abhinav S 23-May-11 12:06pm    
Good advice. 5.
Sergey Alexandrovich Kryukov 23-May-11 12:53pm    
Thank you, Abhinav.
--SA
thatraja 23-May-11 14:30pm    
Of course. Also I prefer textbox than label for this kind of thing(Since VB 6).
Sergey Alexandrovich Kryukov 23-May-11 14:54pm    
Thank you, Raja.
--SA
Wonde Tadesse 23-May-11 22:54pm    
Please see my soln.
I recommend to use 'Infragistic Formatted Text Editors' if you are interested to use third party controls.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900