Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ class Program
{
static void Main(string[] args)
{
//Open a file as a stream.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.md"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
// Open an existing Markdown file.
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.md")))
{
//Load the file stream into a Markdown file.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Markdown))
{
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/MarkdownToWord.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Save a Word document to the file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
// Save as a Word document.
document.Save(Path.GetFullPath(@"Output/MarkdownToWord.docx"), FormatType.Docx);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ static void Main(string[] args)
//Hook the event to customize the image while importing Markdown.
document.MdImportSettings.ImageNodeVisited += MdImportSettings_ImageNodeVisited;
//Open the Markdown file.
document.Open(new FileStream(Path.GetFullPath("Data/Input.md"), FileMode.Open, FileAccess.Read), FormatType.Markdown);

//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Sample.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Save a Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Docx);
}
document.Open(Path.GetFullPath("Data/Input.md"));
//Save as a Word document.
document.Save(Path.GetFullPath(@"../../../Output/Output.docx"));
}
}
private static void MdImportSettings_ImageNodeVisited(object sender, Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ static void Main(string[] args)
paragraph.ApplyStyle("Quote");
//Append text.
IWTextRange textRange = paragraph.AppendText("Hello World");
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Markdown);
}
//Save the document as a Markdown file.
document.Save(Path.GetFullPath(@"Output/Output.md"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ static void Main(string[] args)
paragraph.ApplyStyle("IndentedCode");
//Append text.
textRange = paragraph.AppendText("class Hello\n\t{\n\t\tStatic void Main()\n\t\t{\n\t\t\tConsole.WriteLine(\"Indented Code\")\n\t\t}\n\t}");
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Markdown);
}
//Save the document as a Markdown file.
document.Save(Path.GetFullPath(@"Output/Output.md"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@ class Program
{
static void Main(string[] args)
{
//Open a file as a stream.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
//Open an existing Word document.
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.docx")))
{
//Load the file stream into a Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite))
{
//Save a Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Markdown);
}
}
}
//Save the document as a Markdown file.
document.Save(Path.GetFullPath(@"Output/Output.md"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Drawing;
using Syncfusion.Office.Markdown;
using System.IO;

namespace Customize_image_path
Expand All @@ -9,25 +10,17 @@ class Program
{
static void Main(string[] args)
{
//Open a file as a stream.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
//Load the file stream into a Word document.
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.docx")))
{
//Load the file stream into a Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite))
{
//Hook the event to customize the image.
document.SaveOptions.ImageNodeVisited += SaveImage;
//Save a Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Markdown);
}
}
//Hook the event to customize the image.
document.SaveOptions.MarkdownSaveOptions.ImageNodeVisited += SaveImage;
//Save a Markdown file to the file stream.
document.Save(Path.GetFullPath(@"Output/Output.md"));
}
}
//The following code examples show the event handler to customize the image path and save the image in an external folder.
static void SaveImage(object sender, ImageNodeVisitedEventArgs args)
static void SaveImage(object sender, MdImageNodeVisitedEventArgs args)
{
string imagepath = Path.GetFullPath(@"Output/Output.png");
//Save the image stream as a file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ class Program
{
static void Main(string[] args)
{
//Open a file as a stream.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
//Open an existing Word document.
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data/Input.docx")))
{
//Load the file stream into a Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Create a file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.md"), FileMode.Create, FileAccess.ReadWrite))
{
//Set images folder to export images.
document.SaveOptions.MarkdownExportImagesFolder = Path.GetFullPath(@"Output/");
//Save a Markdown file to the file stream.
document.Save(outputFileStream, FormatType.Markdown);
}
}
//Set images folder to export images.
document.SaveOptions.MarkdownExportImagesFolder = Path.GetFullPath(@"Output/");
//Save the document as a Markdown file.
document.Save(Path.GetFullPath(@"Output/Output.md"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;
using System.IO;
Expand Down
Loading