Hi Aspose,
We have a word document as an input file. We have set certain stylings across the document.When converting this document to an .txt file using aspose object, the stylings set across the document is lost in the output .txt file ceated.Please find below the code we are using for converting purpose.
int saveFormatNumber = Convert.ToInt32(this.convertToTypeComboBox.Text.Split('=')[1].Trim(), CultureInfo.InvariantCulture);
string fileExt = "." + this.convertToTypeComboBox.Text.Split('=')[0].Trim();
SaveFormat saveFormat = (SaveFormat)saveFormatNumber;
Document asposeDocument = new Document(fileName);
string outputfile = outputPath.TrimEnd('\\') + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(fileName) + fileExt;
CopyHeaderFooter(asposeDocument.FirstSection,
HeaderFooterType.HeaderFirst, HeaderFooterType.HeaderPrimary);
CopyHeaderFooter(asposeDocument.FirstSection,
HeaderFooterType.FooterFirst, HeaderFooterType.FooterPrimary);
asposeDocument.Save(outputfile, saveFormat);
The version of aspose we are using is 13.2.0.0
We have attached the input word document and output .txt file used in our application for reference.
Hoping to hear from you soon.
Regards,
Subhashini
Hi Aspose,
The point we would like to highlight in the above mail is that in the word document we have set certain ‘Tab’ Styling for the field ‘Unsecured Arrears’ in the word document, hence distinguishing it from the other fields.
But in the output text file produced, this tabing styling is lost, and the field ‘Unsecured Arrear’ aligns in accordance to other fields, hence loosing its distinguish.
In case of any clarifications or more information needed please feel free to reach us.
Regards,
Subhashini
Hi Aspose,
We encoutered another issue in respect to the above stylings issue posted. Below are few pointer we would like to highlight.
There is a line break after the line “*Lines are open Monday to Friday 8:30am-6:00pm (excluding bank holidays” in the word document, but the line break aint present in the text file produced.
Also there is left spacing in the below section in the header in the word document.
"TEST Customer Service
PO Box 000
Test
TST 000
Tel: 0000 000 0000
www.test.co"
But the same is missing in the text document produced.
Attaching the input word and output text files for your refernce.
Regards,
Subhashini
Hi Subhashini,
Thanks for your inquiry.
subhashini:
We have a word document as an input file. We have set certain stylings across the document.When converting this document to an .txt file using aspose object, the stylings set across the document is lost in the output .txt file ceated.Please find below the code we are using for converting purpose.
Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Txt file format using MS Word, you will get the same output. Please read following documentation link for your kind reference.
https://docs.aspose.com/words/net/save-in-the-plain-text-format/
subhashini:
*There is a line break after the line "Lines are open Monday to Friday 8:30am-6:00pm (excluding bank holidays" in the word document, but the line break aint present in the text file produced.
I have tested the scenario and have managed to reproduce the same issue at my side. See the attached image for this issue. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-11012. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.
subhashini:
Also there is left spacing in the below section in the header in the word document.
…
…
…
But the same is missing in the text document produced.
In this case, I suggest you please use TxtSaveOptions.PreserveTableLayout property with value true. This property specifies whether the program should attempt to preserve layout of tables when saving in the plain text format. See the highlighted code snippet below. Hope this helps you.
Document doc = new Document(MyDir + "Alignment.doc");
CopyHeaderFooter(doc.FirstSection, HeaderFooterType.HeaderFirst, HeaderFooterType.HeaderPrimary);
CopyHeaderFooter(doc.FirstSection, HeaderFooterType.FooterFirst, HeaderFooterType.FooterPrimary);
TxtSaveOptions options = new TxtSaveOptions();
options.PreserveTableLayout = true;
doc.Save(MyDir + "Out.txt", options);
The issues you have found earlier (filed as WORDSNET-11012) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.