Code Monkey home page Code Monkey logo

b2xtranslator's Introduction

Binary(doc,xls,ppt) to OpenXMLTranslator

.NET Core library to convert Microsoft Office binary files (doc, xls and ppt) to Open XML (docx, xlsx and pptx). You can use the Open XML SDK to mainpulate those.

Forked from a .NET 2 Mono implementation under the BSD license.

All code retained from that version ©2009 DIaLOGIKa http://www.dialogika.de/
.NET core port work and move to System.IO.Compression ©2017 Evolution https://www.evolutionjobs.com/

b2xtranslator's People

Contributors

keithhenry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

b2xtranslator's Issues

Nuget packages.

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.

"Stream with name 'WordDocument' not found."

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

convert ppt to pptx throw a System.ObjectDisposedException:“Cannot access a closed stream”

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.
image
My project framework is. net core3.1
I encountered the same error running on. net framework 4.6.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.