Skip to content

Commit 8b11d2c

Browse files
committed
Remove not working samples
1 parent 1ace605 commit 8b11d2c

File tree

6 files changed

+15
-162
lines changed

6 files changed

+15
-162
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Packages can be installed via NuGet:
1919
The optional extra packages [DocSharp.ImageSharp](https://www.nuget.org/packages/DocSharp.ImageSharp/), [DocSharp.SystemDrawing](https://www.nuget.org/packages/DocSharp.SystemDrawing/), DocSharp.MagickNET (not published yet) allow to convert unsupported images (e.g. GIF / TIFF for DOCX -> RTF or WMF / EMF / TIFF for DOCX -> Markdown/HTML). Each of these has pros and cons, the choice depends on your requirements. More information can be found in the [Wiki](https://github.com/manfromarce/DocSharp/wiki/Convert-images).
2020

2121
The codebase also contains few experimental converters that are not ready and not published on NuGet yet:
22-
- DocSharp.Renderer: provides basic DOCX and XLSX to PDF/images/SVG/XPS conversion using [QuestPDF](https://github.com/QuestPDF/QuestPDF).
23-
- DocSharp.Epub: provides basic EPUB to DOCX (via HTML) conversion.
2422
- RTF to DOCX converter class in the DocSharp.Docx project
23+
- DocSharp.Renderer: provides DOCX to PDF/images/SVG/XPS conversion using [QuestPDF](https://github.com/QuestPDF/QuestPDF).
24+
- DocSharp.Ebook: provides basic EPUB to DOCX (via HTML) conversion.
2525

2626
There is no common DOM to manipulate or generate documents, this library is mainly for conversion. Some helper methods on top of the [Open XML SDK](https://github.com/dotnet/Open-XML-SDK) and format-specific writers are available, but they are mostly intended for internal use; however they could be extended/improved in the future.
2727
You can consider using the Open XML SDK itself or other <a href="#recommended_libraries">recommended libraries</a> for documents creation and manipulation. Some of these are used in the sample app to test two-steps conversions, compare results, or generate documents in multiple formats with the same code.
@@ -80,8 +80,10 @@ Others:
8080
<a id="recommended_libraries"></a>
8181
Other recommended libraries (some of these are used in the sample app, *not* dependencies when installing packages):
8282
- Read, write, manipulate docuents:
83+
+ [Open XML SDK](https://github.com/dotnet/Open-XML-SDK) - DOCX, XLSX, PPTX
8384
+ [OfficeIMO](https://github.com/EvotecIT/OfficeIMO) - DOCX, XLSX, PPTX, Markdown, CSV; can also merge, compare and convert some formats
8485
+ [Clippit](https://github.com/sergey-tihon/Clippit) - DOCX, XLSX, PPTX; can also merge, compare and convert some formats
86+
+ [Openize.OpenXML-SDK](https://github.com/openize-com/openize-open-xml-sdk-net) - DOCX, XLSX, PPTX
8587
+ [ShapeCrawler](https://github.com/ShapeCrawler/ShapeCrawler) - PPTX; can also render slides to images
8688
+ [ClosedXML](https://github.com/ClosedXML/ClosedXML) - XLSX
8789
+ [Sylvan.Data.Excel](https://github.com/MarkPflug/Sylvan.Data.Excel) - XLSX, XLS, XLSB
@@ -101,17 +103,14 @@ Other recommended libraries (some of these are used in the sample app, *not* dep
101103
+ XLSX: [MiniExcel](https://github.com/mini-software/MiniExcel), [ClosedXML.Report](https://github.com/ClosedXML/ClosedXML.Report)
102104
+ XLSX, ODS, CSV: [FreeDataExports](https://github.com/ryankueter/FreeDataExports)
103105
- Convert or render documents:
104-
+ [XlsxToHtmlConverter](https://github.com/Fei-Sheng-Wu/XlsxToHtmlConverter)
105-
+ [PeachPdf](https://github.com/jhaygood86/PeachPDF)
106-
+ [HTML-Renderer](https://github.com/ArthurHub/HTML-Renderer)
107-
+ [Html2OpenXml](https://github.com/onizet/html2openxml)
108-
+ [ReverseMarkdown](https://github.com/mysticmind/reversemarkdown-net)
109-
+ [PDFtoImage](https://github.com/sungaila/PDFtoImage)
110-
+ [PdfPig.Rendering.Skia](https://github.com/BobLd/PdfPig.Rendering.Skia)
111-
+ [PdfToSvg.NET](https://github.com/dmester/pdftosvg.net)
112-
+ [Markdig](https://github.com/xoofx/markdig)
113-
+ [QuestPDF.Markdown](https://github.com/christiaanderidder/QuestPDF.Markdown)
114-
+ [VectSharp.Markdown + VectSharp.PDF](https://github.com/arklumpus/VectSharp)
106+
+ XLSX: [XlsxToHtmlConverter](https://github.com/Fei-Sheng-Wu/XlsxToHtmlConverter)
107+
+ HTML to PDF/images: [HTML-Renderer](https://github.com/ArthurHub/HTML-Renderer), [PeachPdf](https://github.com/jhaygood86/PeachPDF), [Puppeteer Sharp](https://github.com/hardkoded/puppeteer-sharp), [Westwind.WebView](https://github.com/RickStrahl/Westwind.WebView)
108+
+ HTML to DOCX: [Html2OpenXml](https://github.com/onizet/html2openxml)
109+
+ HTML to Markdown: [ReverseMarkdown](https://github.com/mysticmind/reversemarkdown-net)
110+
+ Markdown to HTML: [Markdig](https://github.com/xoofx/markdig)
111+
+ AsciiDoc to HTML: [NAsciidoc](https://github.com/rmannibucau/NAsciidoc)
112+
+ Markdown to PDF: [QuestPDF.Markdown](https://github.com/christiaanderidder/QuestPDF.Markdown), [MarkdownToPdf](https://github.com/geertjanthomas/MarkdownToPdf), [VectSharp.Markdown + VectSharp.PDF](https://github.com/arklumpus/VectSharp)
113+
+ PDF to images/SVG: [PDFtoImage](https://github.com/sungaila/PDFtoImage), [PdfPig.Rendering.Skia](https://github.com/BobLd/PdfPig.Rendering.Skia), [PdfToSvg.NET](https://github.com/dmester/pdftosvg.net)
115114

116115
### License
117116

samples/WpfApp1/MainWindow.xaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
<Button
7070
Click="DocxToImages_Click"
7171
Content="Docx to images" />
72-
<Button
73-
Click="XlsxToPdf_Click"
74-
Content="Xlsx to Pdf" />
7572
<Button
7673
Click="ViewDocx_Click"
7774
Content="View Docx document" />
@@ -113,13 +110,7 @@
113110
Content="Generate DOCX, PDF, RTF, HTML (via Open XML SDK)" />
114111
<Button
115112
Click="GenerateMigraDoc_Click"
116-
Content="Generate PDF, RTF, DOCX (via MigraDoc)" />
117-
<Button
118-
Click="Generate_iTextSharpLGPL_Click"
119-
Content="Generate PDF, HTML, RTF, DOCX (via iTextSharp.LGPL)" />
120-
<Button
121-
Click="GenerateXlsx_Click"
122-
Content="Generate XLSX + PDF (via ClosedXML)" />
113+
Content="Generate PDF, RTF, DOCX (via MigraDoc)" />
123114
</UniformGrid>
124115
</Grid>
125116
</ScrollViewer>

samples/WpfApp1/MainWindow.xaml.cs

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -803,37 +803,6 @@ private void XlsToHtml_Click(object sender, RoutedEventArgs e)
803803
}
804804
}
805805

806-
private void XlsxToPdf_Click(object sender, RoutedEventArgs e)
807-
{
808-
var ofd = new OpenFileDialog()
809-
{
810-
Filter = "Excel OpenXML document|*.xlsx;*.xltx;*.xlsm;*.xltm",
811-
Multiselect = false,
812-
};
813-
if (ofd.ShowDialog(this) == true)
814-
{
815-
var sfd = new SaveFileDialog()
816-
{
817-
Filter = "Portable Document Format|*.pdf",
818-
FileName = Path.GetFileNameWithoutExtension(ofd.FileName) + ".pdf"
819-
};
820-
if (sfd.ShowDialog(this) == true)
821-
{
822-
try
823-
{
824-
var converter = new XlsxRenderer()
825-
{
826-
};
827-
converter.SaveAsPdf(ofd.FileName, sfd.FileName);
828-
}
829-
catch (Exception ex)
830-
{
831-
MessageBox.Show(ex.Message);
832-
}
833-
}
834-
}
835-
}
836-
837806
private void GenerateDocx_Click(object sender, RoutedEventArgs e)
838807
{
839808
var sfd = new SaveFileDialog()
@@ -976,109 +945,4 @@ private void GenerateMigraDoc_Click(object sender, RoutedEventArgs e)
976945
}
977946
}
978947
}
979-
980-
private void Generate_iTextSharpLGPL_Click(object sender, RoutedEventArgs e)
981-
{
982-
var pdfFilePath = "iTextSharpLGPL.pdf";
983-
var rtfFilePath = "iTextSharpLGPL.rtf";
984-
var htmlFilePath = "iTextSharpLGPL.html";
985-
var docxFilePath = "iTextSharpLGPL.docx";
986-
987-
// Generate PDF, HTML and RTF document using iTextSharp.LGPLv2.Core
988-
var document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4);
989-
var pdfFileStream = new FileStream(pdfFilePath, FileMode.Create);
990-
var rtfFileStream = new FileStream(rtfFilePath, FileMode.Create);
991-
var htmlFileStream = new FileStream(htmlFilePath, FileMode.Create);
992-
var pdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(document, pdfFileStream);
993-
var rtfWriter = iTextSharp.text.rtf.RtfWriter2.GetInstance(document, rtfFileStream);
994-
var htmlWriter = iTextSharp.text.html.HtmlWriter.GetInstance(document, htmlFileStream);
995-
document.AddAuthor(System.Environment.UserName);
996-
document.Open();
997-
var fontTitle = iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 16, iTextSharp.text.Font.BOLD);
998-
var parTitle = new iTextSharp.text.Paragraph("This is a new document", fontTitle);
999-
var phrase = new iTextSharp.text.Phrase();
1000-
var boldChunk = new iTextSharp.text.Chunk("Bold, ", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD));
1001-
var italicChunk = new iTextSharp.text.Chunk("italic, ", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.ITALIC));
1002-
var underlineChunk = new iTextSharp.text.Chunk("underlined, ", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.UNDERLINE));
1003-
var strikeChunk = new iTextSharp.text.Chunk("strikethrough ", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.STRIKETHRU));
1004-
var regularChunk = new iTextSharp.text.Chunk("text", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.NORMAL));
1005-
phrase.Add(boldChunk);
1006-
phrase.Add(italicChunk);
1007-
phrase.Add(underlineChunk);
1008-
phrase.Add(strikeChunk);
1009-
phrase.Add(regularChunk);
1010-
var parBody = new iTextSharp.text.Paragraph(phrase);
1011-
document.Add(parTitle);
1012-
document.Add(parBody);
1013-
document.Dispose();
1014-
pdfFileStream.Dispose();
1015-
rtfFileStream.Dispose();
1016-
htmlFileStream.Dispose();
1017-
1018-
// Convert RTF to DOCX
1019-
var converter = new RtfToDocxConverter();
1020-
converter.Convert(rtfFilePath, docxFilePath);
1021-
}
1022-
1023-
private void GenerateXlsx_Click(object sender, RoutedEventArgs e)
1024-
{
1025-
var sfd = new SaveFileDialog()
1026-
{
1027-
Filter = "Excel OpenXML document|*.xlsx",
1028-
};
1029-
if (sfd.ShowDialog(this) == true)
1030-
{
1031-
try
1032-
{
1033-
string pdfFilePath = Path.ChangeExtension(sfd.FileName, ".pdf");
1034-
// Create a new XLSX workbook using ClosedXML
1035-
using (var workbook = new ClosedXML.Excel.XLWorkbook())
1036-
{
1037-
// Add a new worksheet
1038-
var worksheet = workbook.Worksheets.Add("Foglio1");
1039-
1040-
// Add values to the first 5 rows and 3 columns of the sheet
1041-
worksheet.Cell(1, 1).Value = "Header 1";
1042-
worksheet.Cell(1, 2).Value = "Header 2";
1043-
worksheet.Cell(1, 3).Value = "Header 3";
1044-
1045-
worksheet.Cell(2, 1).Value = "Value 1A";
1046-
worksheet.Cell(2, 2).Value = "Value 1B";
1047-
worksheet.Cell(2, 3).Value = "Value 1C";
1048-
1049-
worksheet.Cell(3, 1).Value = "Value 2A";
1050-
worksheet.Cell(3, 2).Value = "Value 2B";
1051-
worksheet.Cell(3, 3).Value = "Value 2C";
1052-
1053-
worksheet.Cell(4, 1).Value = "Value 3A";
1054-
worksheet.Cell(4, 2).Value = "Value 3B";
1055-
worksheet.Cell(4, 3).Value = "Value 3C";
1056-
1057-
worksheet.Cell(5, 1).Value = "Value 4A";
1058-
worksheet.Cell(5, 2).Value = "Value 4B";
1059-
worksheet.Cell(5, 3).Value = "Value 4C";
1060-
1061-
// Apply formatting to the header row
1062-
var headerRange = worksheet.Range(1, 1, 1, 3);
1063-
headerRange.Style.Font.Bold = true;
1064-
headerRange.Style.Fill.BackgroundColor = ClosedXML.Excel.XLColor.LightGray;
1065-
headerRange.Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
1066-
1067-
// Save file
1068-
workbook.SaveAs(sfd.FileName);
1069-
1070-
}
1071-
// Render document to PDF
1072-
var converter = new XlsxRenderer()
1073-
{
1074-
};
1075-
converter.SaveAsPdf(sfd.FileName, pdfFilePath);
1076-
1077-
}
1078-
catch (Exception ex)
1079-
{
1080-
MessageBox.Show(ex.Message);
1081-
}
1082-
}
1083-
}
1084948
}

samples/WpfApp1/WpfApp1.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<PackageReference Include="XlsxToHtmlConverter" Version="2.0.0" />
1515
<PackageReference Include="PDFsharp-MigraDoc" Version="6.2.4" />
1616
<PackageReference Include="ClosedXML" Version="0.105.0" />
17-
<PackageReference Include="iTextSharp.LGPLv2.Core" Version="3.7.12" />
1817
</ItemGroup>
1918

2019
<ItemGroup>

src/WIP/DocSharp.Renderer/QuestPdfXlsxRendererExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace DocSharp.Renderer;
1313

14-
public static class QuestPdfXlsxRendererExtensions
14+
internal static class QuestPdfXlsxRendererExtensions
1515
{
1616
/// <summary>
1717
/// Save the rendered document as PDF.

src/WIP/DocSharp.Renderer/XlsxRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace DocSharp.Renderer;
1717

18-
public class XlsxRenderer : IDocumentRenderer<QuestPDF.Fluent.Document>
18+
internal class XlsxRenderer : IDocumentRenderer<QuestPDF.Fluent.Document>
1919
{
2020
static XlsxRenderer()
2121
{

0 commit comments

Comments
 (0)