Cannot read that as a zip file. How can I fix this?

  • Thread starter Thread starter Akhil963
  • Start date Start date
A

Akhil963

Guest
I am trying to store output of a program into word file and using the concept shown in code below.

However, doing that I am getting this error "Cannot read that as a zip file" at the Document.docx stage.

How can I fix this error?

using GemBox.Document;
using
System;
using
System.Collections.Generic;
using
System.IO;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
int a = 42;
int b = 119;
int c = a + b;
Console.WriteLine(c);
var previousWriter = Console.Out;
var textWriter = new StringWriter();
Console.SetOut(textWriter);
Console.SetOut(previousWriter);
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var document = DocumentModel.Load("Document.docx");
document.
Content.End.LoadText(textWriter.ToString());
document.
Save("Document.docx");
}
}
}


Continue reading...
 
Back
Top