We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17778. We will further look into the details of this problem and will keep you updated on the status of the linked issue.
//Workaround with Aspose.PDF
using (MemoryStream ms = new MemoryStream())
{
d.Save(ms, new Aspose.Words.Saving.PdfSaveOptions()
{
PrettyFormat = true,
UpdateFields = true,
});
ms.Seek(0, SeekOrigin.Begin); // Reset MemorySteeam to posion 0/begin;
using (Aspose.Pdf.Document pdfFile = new Aspose.Pdf.Document(ms)) {
// Create TextAbsorber object to extract text
Aspose.Pdf.Text.TextAbsorber textAbsorber = new Aspose.Pdf.Text.TextAbsorber() ;
// Accept the absorber for all the pages
pdfFile.Pages.Accept(textAbsorber);
// Get the extracted text
string extractedText = textAbsorber.Text;
// Create a writer and open the file
using (TextWriter tw = new StreamWriter(Path.Combine(SampleFiles, “Word2PdfSampleIdent.docx.txt”), false, Encoding.UTF8))
{
// Write a line of text to the file
tw.WriteLine(extractedText);
// Close the stream
tw.Close();
}
}
}
}
Thanks for the additional information. We have logged these details in our issue tracking system. We will inform you via this thread as soon as this issue (WORDSNET-17778) is resolved. We apologize for any inconvenience.
Regarding WORDSNET-17778, the following public class is introduced that allows specifying how list levels are indented when exporting to a plain text format:
/// <summary>
/// Specifies how list levels are indented when document is exporting to SaveFormat.Text format.
/// </summary>
public class TxtListIndentation
It has two public properties (Count and Character) for specifying how many and which character to use for indentation of list levels. A new option is also added to the TxtSaveOptions class:
/// <summary>
/// Gets a ListIndentation object that specifies how many and which character to use for indentation of list levels.
/// By default it is zero count of character '\0', that means no indentation.
/// </summary>
public TxtListIndentation ListIndentation
Here are a few usecases:
UC1: Use one tab character per level for list indentation:
Document doc = new Document("input_document");
TxtSaveOptions options = new TxtSaveOptions();
options.ListIndentation.Count = 1;
options.ListIndentation.Character = '\t';
doc.Save("output.txt", options);
UC2: Use three spaces per one level for list indentation:
Document doc = new Document("input_document");
TxtSaveOptions options = new TxtSaveOptions();
options.ListIndentation.Count = 3;
options.ListIndentation.Character = ' ';
doc.Save("output.txt", options);
UC3: Do not use any list level indentation (default behavior):
Document doc1 = new Document("input_document");
doc1.Save("output1.txt");
Document doc2 = new Document("input_document");
TxtSaveOptions options = new TxtSaveOptions();
doc2.Save("output2.txt", options);