Accent lors la conversion .doc en txt en c#
08815266
Messages postés
67
Statut
Membre
-
08815266 Messages postés 67 Statut Membre -
08815266 Messages postés 67 Statut Membre -
je suis en trin de développer une application asp.net en c# et j'ai une fonction sert à convertir un document Word en texte(.txt), le problème est aprés la conversion le texte produite contient dans la place das lettres accentuées une ?, cela veux dire que la le convertisseur ne lit pas le français, y a til un solution pour indiqué que le langage utilisé est le français.
la fonction de conversion est la suivante :
void DocToTxt(string docPath, string htmlPath)
{
// ouverture de Word
Microsoft.Office.Interop.Word.Application app = new
Microsof t.Office.Interop.Word.Application();
// on le cache !
app.Visible = false;
// pour les paramètres qu'on ne va pas fournir :
object o = Missing.Value;
object docFile = docPath; // chemin du doc avec transtypage
// Ouverture du document :
_Document doc = app.Documents.Open(ref docFile, ref o, ref o,
ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o,
ref o, ref o, ref o, ref o, ref o);
object fileName = htmlPath; // Chemin de destination
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatText;//Txt
// On enregistre le doc au format texte :
doc.SaveAs(ref fileName, ref format, ref o, ref o, ref o, ref o,
ref o, ref o, ref o, ref o, ref o, ref o, ref o,
ref o, ref o, ref o);
object t = true;
// On quitte en évitant les messages de fermeture
doc.Close(ref o, ref o, ref o);
app.Quit(ref o, ref o, ref o);
}
la fonction de conversion est la suivante :
void DocToTxt(string docPath, string htmlPath)
{
// ouverture de Word
Microsoft.Office.Interop.Word.Application app = new
Microsof t.Office.Interop.Word.Application();
// on le cache !
app.Visible = false;
// pour les paramètres qu'on ne va pas fournir :
object o = Missing.Value;
object docFile = docPath; // chemin du doc avec transtypage
// Ouverture du document :
_Document doc = app.Documents.Open(ref docFile, ref o, ref o,
ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o,
ref o, ref o, ref o, ref o, ref o);
object fileName = htmlPath; // Chemin de destination
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatText;//Txt
// On enregistre le doc au format texte :
doc.SaveAs(ref fileName, ref format, ref o, ref o, ref o, ref o,
ref o, ref o, ref o, ref o, ref o, ref o, ref o,
ref o, ref o, ref o);
object t = true;
// On quitte en évitant les messages de fermeture
doc.Close(ref o, ref o, ref o);
app.Quit(ref o, ref o, ref o);
}
A voir également:
- Accent lors la conversion .doc en txt en c#
- .Doc - Guide
- Comment ouvrir un fichier doc ? - Guide
- E accent minuscule - Guide
- Conversion mb en mo ✓ - Forum Bureautique
- Conversion bytes en mo - Forum Réseau