Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Jun 15, 2011 1:18 pm

Hello Sir,
I am developing a windows service in C# using visual studio 2010 for reading emails that have .doc, .docx, .rtf, .txt attachment files. I am using the Spire.Doc Pro Edition for .NET component to convert these file to native text . the .doc and .docx files were converted succefully but .rtf and .txt did not converted at all .

Code: Select all
              switch (strFileExtension)
                        {
                            case "docx":
                                document.LoadFromFile(MailAttachmentPath + strNewFileName + "." + strFileExtension, FileFormat.Docx);
                                document.SaveToFile(MailAttachmentPath + strFileNameWithoutExtension + ".txt", FileFormat.Txt);
                                document.Close();
                                break;
                            case "doc":
                                document.LoadFromFile(MailAttachmentPath + strNewFileName + "." + strFileExtension, FileFormat.Doc);
                                document.SaveToFile(MailAttachmentPath + strFileNameWithoutExtension + ".txt", FileFormat.Txt);
                                document.Close();
                                break;
                            case "rtf":
                                document.LoadFromFile(MailAttachmentPath + strNewFileName + "." + strFileExtension, FileFormat.Rtf);
                                document.SaveToFile(MailAttachmentPath + strFileNameWithoutExtension + ".txt", FileFormat.Txt);
                                document.Close();
                                break;
                            case "txt":
                                document.LoadFromFile(MailAttachmentPath + strNewFileName + "." + strFileExtension, FileFormat.Txt);
                                document.SaveToFile(MailAttachmentPath + strFileNameWithoutExtension + ".txt", FileFormat.Txt);
                                document.Close();
                                break;
                        }


In case of case "txt" when the file contains text like :

ãßÊÈ æßÇáÉ ÇáÃäÈÇÁ ÇáÓÚæÏíÉ ÈÇáÞÇåÑÉ íÍííßã æíÈÏà ãÚßã ÈËå áåÐÇ Çáíæã ÇáÃÑÈÚÇÁ ÇáãæÇÝÞ 13 ÑÌÈ 1432åÜ ãßÊÈ æßÇáÉ ÇáÃäÈÇÁ ÇáÓÚæÏíÉ ÈÇáÞÇåÑÉ íÍííßã æíÈÏà ãÚßã ÈËå áåÐÇ Çáíæã ÇáÃÑÈÚÇÁ ÇáãæÇÝÞ 13 ÑÌÈ 1432åÜ /1/ ÇåÊãÇãÇÊ ÇáÕÍÝ ÇáãÕÑíÉ ÇáÞÇåÑÉ 13 ÑÌÈ 1432åÜ ÇáãæÇÝÞ 15 íæäíæ 2011ã æÇÓ ÇÓÊÍæÐ äÈà ÊÍÞíÞ äíÇÈÉ Ããä

i have the exception :

[color=#FF0040]System.IndexOutOfRangeException was unhandled Message=Index was outside the bounds of the array. Source=Spire.Doc[/color]

So what is the problem ?

Thanks

aasen
 
Posts: 8
Joined: Tue May 31, 2011 7:30 am
Location: KSA

Thu Jun 16, 2011 1:37 am

Dear aasen,
Thanks for your inqury.
#About rtf files, please upload your rtf file so that we can reproduce the problem.
#About txt files, you don't have to do that. You can just save it.
Justin
Technical Support / Developer,
e-iceblue Support Team
User avatar

Justin Weng
 
Posts: 110
Joined: Mon Mar 28, 2011 5:54 am

Sat Jun 18, 2011 6:32 am

Dear sir,
I tried to attach .rtf file but i got the following message :

The extension rtf is not allowed.
The upload was rejected because the uploaded file was identified as a possible attack vector.


I winrar it to be able to attach it . I am using a trial version of your component for testing.

Thanks

aasen
 
Posts: 8
Joined: Tue May 31, 2011 7:30 am
Location: KSA

Mon Jun 20, 2011 5:23 am

Dear aasen,
Thanks for your inquiry.
We've seen your "rtf" file source code and found that it actually is not a rtf file.
Justin
Technical Support / Developer,
e-iceblue Support Team
User avatar

Justin Weng
 
Posts: 110
Joined: Mon Mar 28, 2011 5:54 am

Mon Jun 20, 2011 1:30 pm

Dear sir,
I opened a word file that contains arabic text then from the Menu File Item i saved it as a .rtf file after that i converted it to .txt file using the spire.doc component. the .doc and .rtf files was readable but the .txt file was unreadable. do you have any idea to solve this problem ? i attached the three files so you can have a look on them.

Thanks

aasen
 
Posts: 8
Joined: Tue May 31, 2011 7:30 am
Location: KSA

Wed Jun 22, 2011 6:46 am

Hi,

Thanks for your feedback.

Our technical support will release a hot fix to solve this problem. Once we publish the hot fix, we will inform you at once.

Please do not hesitate to contact us for anything at any time.

Best Regards
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Tue Jul 19, 2011 11:34 am

Dear Sir,
I downloaded spire.doc_4.0.5 , I did my testing again and the problem was solved.
I have another problem that not related to the spire.doc product and i need your help please. the problem is that when i save email attachment files with extension .txt that contains arabic text, the text was unreadable on the development machin like the following :

æäÞáÊ ÕÍíÝÉ ÇáÏÓÊæÑ Úä ÕÍíÝÉ ÇáÌÇÑÏíÇä ÊÃßíÏåÇ ÈÃä ÎÇÏã ÇáÍÑãíä ÇáÔÑíÝíä Çáãáß ÚÈÏÇááå Èä ÚÈÏÇáÚÒíÒ íÎæÖ ãÚÑßÉ ÇáÅÕáÇÍ Ýí ãæÇÌåÉ ÑÌÇá ÇáÏíä ÇáãÊÔÏÏíä ÈÇáããáßÉ æÇáÐíä íÚÇÑÖæä ÊÍÑßÇÊå æíÕÝæäåÇ ÈÃäåÇ ÊÈÊÚÏ ÊÏÑíÌíÇ Úä ÇáÅÓáÇã.
æÃÈÑÒÊ ÕÍíÝÉ ÇáÌãåæÑíÉ äÈà ÓÏÇÏ ÇáããáßÉ ÇáÚÑÈíÉ ÇáÓÚæÏíÉ ßÇãá ÍÕÊåÇ Ýí ãæÇÒäÉ ÇáÌÇãÚÉ ÇáÚÑÈíÉ áÚÇã 2011æÇáÈÇáÛÉ 2Ñ8 ãáíæä ÏæáÇÑ æÐáß ÎáÇá áÞÇÁ ÇáÃãíä ÇáÚÇã ááÌÇãÚÉ ÇáÏßÊæÑ äÈíá ÇáÚÑÈí ãÚ ãÚÇáì ÓÝíÑ ÎÇÏã ÇáÍÑãíä ÇáÔÑíÝíä æãäÏæÈ ÇáããáßÉ ÇáÏÇÆã áÏì ÇáÌÇãÚÉ ÇáÚÑÈíÉ ÇÍãÏ ÚÈÏÇáÚÒíÒ ÞØÇä ÃãÓ ÍíË ÞÇã ãÚÇáíå ÈÊÓáíã ÇáÃãíä ÇáÚÇã ÔíßÇ ÈÇáãÈáÛ.

but on the production machin the text is readable and there is no problem.

My development machin is windows 7 64-bit operating system
The production machine is windows server 2003 R2 service pack2 operating system

So what is the problem ?

Thanks

aasen
 
Posts: 8
Joined: Tue May 31, 2011 7:30 am
Location: KSA

Wed Jul 20, 2011 1:57 am

Dear aasen,
Thanks for your inquiry.
When save file to .txt, you shoule specify the encoding to UTF8/UNICODE.
So I think it should be readable.
Justin
Technical Support / Developer,
e-iceblue Support Team
User avatar

Justin Weng
 
Posts: 110
Joined: Mon Mar 28, 2011 5:54 am

Return to Spire.Doc