Comment puis-je convertir au format texte à partir de RTF en utilisant ASP.Net?Comment convertir Rtf en texte en utilisant ASP.Net?
2
A
Répondre
0
Vous ne savez pas si this aide. Mais sinon, google est ton ami.
4
Vous avez des instructions sur MSDN
En C#
class ConvertFromRTF
{
static void Main()
{
string path = @"test2.rtf";
//Create the RichTextBox. (Requires a reference to System.Windows.Forms.dll.)
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
// Get the contents of the RTF file. Note that when it is
// stored in the string, it is encoded as UTF-16.
string s = System.IO.File.ReadAllText(path);
// Display the RTF text.
System.Windows.Forms.MessageBox.Show(s);
// Convert the RTF to plain text.
rtBox.Rtf = s;
string plainText = rtBox.Text;
// Display plain text output in MessageBox because console
// cannot display Greek letters.
System.Windows.Forms.MessageBox.Show(plainText);
// Output plain text to file, encoded as UTF-8.
System.IO.File.WriteAllText(@"output.txt", plainText);
}
}
+0
Cela fonctionnera en winforms mais peut causer des problèmes sérieux dans une application asp.net. Vous pouvez obtenir l'exception "Impossible de créer Windows gérer" – Sam
+0
@Sam devrait fonctionner si vous supprimez les lignes Windows.Forms.MessageBox. Je viens de quitter l'exemple entier. –
Questions connexes
- 1. Comment convertir un balisage wiki en RTF?
- 2. comment convertir du texte en rtf, pour envoyer un email?
- 3. Convertir le flux RTF en flux de texte brut
- 4. Set texte RTF en WPF RichTextBox contrôle
- 5. Convertir PDF en fichier texte en utilisant VB.net
- 6. Combiner plusieurs textes RTF dans un fichier RTF en utilisant VBA
- 7. Comment convertir la parole en texte?
- 8. Convertir XML en texte brut
- 9. Comment convertir reStructuredText en texte brut
- 10. Nettoyage du texte RTF
- 11. Convertir un mémo en texte
- 12. Comment extraire/insérer du texte dans une chaîne RTF en C#
- 13. comment convertir une table mysql en fichier texte en php?
- 14. Comment convertir du texte en Wave en utilisant SAPI avec multithreading?
- 15. insérer l'image dans un fichier RTF en utilisant PHP
- 16. Python: Comment convertir le texte au format markdown en texte
- 17. Convertir WAV en WMA en utilisant .NET
- 18. Convertir xml en xsd en utilisant java
- 19. Comment convertir HTML en RTF (Rich Text) dans .NET sans payer pour un composant?
- 20. Comment convertir un hex en décimal en utilisant VB.NET?
- 21. RTF Datawindow et RTF Control Contenu comment trouver le texte par couleur, Nom de la police?
- 22. Ruby: Convertir HTML/Redcloth en texte brut
- 23. Comment remplacer du texte en utilisant JavaScript?
- 24. doe quelqu'un sait d'un outil gratuit ou comment convertir un fichier rtf en jpg
- 25. iPhone NSString convertir en texte lisible
- 26. Convertir l'entrée de texte brut en HTML
- 27. Est-il possible de convertir du texte UTF32 en UTF16 en utilisant uniquement l'API Windows?
- 28. Comment récupérer du texte sélectionné en utilisant Regex en C#?
- 29. Making texte en gras en utilisant Writer flux en C#
- 30. Comment faire pour convertir le texte ANSEL en UTF-8
Je pris la liberté de changer votre poste de style "commande" dans une question. Nous aimons aider, mais nous n'aimons pas être dirigés. –