evolutionjobs / b2xtranslator Goto Github PK
View Code? Open in Web Editor NEW.NET Core library to convert Microsoft Office binary files (doc, xls and ppt) to Open XML (docx, xlsx and pptx).
License: BSD 3-Clause "New" or "Revised" License
.NET Core library to convert Microsoft Office binary files (doc, xls and ppt) to Open XML (docx, xlsx and pptx).
License: BSD 3-Clause "New" or "Revised" License
I keep getting this issue when I try to use this library
`
var file = new FileInfo(Input);
var reader = new StructuredStorageReader(file.FullName);
var doc = new b2xtranslator.DocFileFormat.WordDocument(reader);
var docx = WordprocessingDocument.Create(Output, b2xtranslator.OpenXmlLib.OpenXmlPackage.DocumentType.Document);
b2xtranslator.WordprocessingMLMapping.Converter.Convert(doc, docx);
`
It throws in the instantiation of the WordDocument
How easy/hard would it be to add the option of going from open xml to legacy binary docs?
Using the source code to convert a file, it seems to be stuck in a while iteration and the conversion hangs.
Debugging seems to show that the segment of the code is:
\Doc\WordprocessingMLMapping\DocumentMapping.cs at line 298.
Basically, it is inside the buildTableGrid method.
It is similar to:
https://sourceforge.net/p/b2xtranslator/tracker-doc2x-maintenance/141/
Hello, EvolutionJobs team. Are you planning to add a library to Nuget? it would be useful to have three separate packages - b2xtranslator.Doc, b2xtranslator.Xls, b2xtranslator.Ppt.
using b2xtranslator.OpenXmlLib.PresentationML;
using b2xtranslator.PptFileFormat;
using b2xtranslator.PresentationMLMapping;
using b2xtranslator.Shell;
using b2xtranslator.StructuredStorage.Reader;
using System;
using System.Globalization;
namespace PPTAnalysis
{
internal class Program
{
public static string ChoosenOutputFile;
static void Main(string[] args)
{
var InputFile = @"D:\myppt.ppt";
var procFile = new ProcessingFile(InputFile);
if (ChoosenOutputFile == null)
{
if (InputFile.Contains("."))
{
ChoosenOutputFile = InputFile.Remove(InputFile.LastIndexOf(".")) + ".pptx";
}
else
{
ChoosenOutputFile = InputFile + ".pptx";
}
}
using (var reader = new StructuredStorageReader(procFile.File.FullName))
{
var ppt = new PowerpointDocument(reader);
var outType = Converter.DetectOutputType(ppt);
string conformOutputFile = Converter.GetConformFilename(ChoosenOutputFile, outType);
var pptx = PresentationDocument.Create(conformOutputFile, outType);
var start = DateTime.Now;
Console.WriteLine("Converting file {0} into {1}", InputFile, conformOutputFile);
Converter.Convert(ppt, pptx);
var end = DateTime.Now;
var diff = end.Subtract(start);
Console.WriteLine("Conversion of file {0} finished in {1} seconds", InputFile, diff.TotalSeconds.ToString(CultureInfo.InvariantCulture));
reader.Dispose();
}
Console.WriteLine("OK");
Console.ReadKey();
}
}
}
When executed [var ppt = new PowerpointDocument(reader)], throw the exception.
My project framework is. net core3.1
I encountered the same error running on. net framework 4.6.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.