如何使用c#.net将pdf文件转换为excel文件

如何使用c#.net将pdf文件转换为excel文件

问题描述:

Plz给我的想法或源代码将pdf转换为excel in c#。

Plz give me the idea or source code to convert the pdf to excel in c#.

export-pdf-as-excel-using-c [ ^ ]


使用System;

使用System.Diagnostics;

使用System.IO;

使用PdfSharp;

使用PdfSharp.Drawing;

使用PdfSharp.Pdf;

使用PdfSharp.Pdf.IO;

使用PdfSharp.Pdf.Advanced;

名称空间WorkOnPdfObjects

{

class program

{

static void Main( )

{

const string filename =Portable Document Format.pdf;

File.Copy(Path.Combine(../ ../../../../PDFs/,filename),

Path.Combine(Directory.GetCurrentDirectory(),filename),true);

PdfDocument document = PdfReader.Open(filename);

PdfDictionary dict = new PdfDictionary(document);

dict.Elements [/ S] =新的PdfName(/ GoTo);

PdfArray array = new PdfArray(document);

dict.Elements [/ D] =数组;

PdfReference iref = PdfInternals.GetReference(document.Pages [2]);

array.Elements.Add(iref);

array.Elements.Add(new PdfName(/ FitV));

数组.Elements.Add(new PdfInteger(-32768));

document.Internals.AddObject(dict);

document.Internals.Catalog.Elements [/ OpenAction] =

PdfInternals.GetReference(dict);

document.Save(filename);

Process.Start(filename);

}

}

}





尝试这个我认为它会对你有所帮助
using System;
using System.Diagnostics;
using System.IO;
using PdfSharp;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
using PdfSharp.Pdf.Advanced;
namespace WorkOnPdfObjects
{
class Program
{
static void Main()
{
const string filename = "Portable Document Format.pdf";
File.Copy(Path.Combine("../../../../../PDFs/", filename),
Path.Combine(Directory.GetCurrentDirectory(), filename), true);
PdfDocument document = PdfReader.Open(filename);
PdfDictionary dict = new PdfDictionary(document);
dict.Elements["/S"] = new PdfName("/GoTo");
PdfArray array = new PdfArray(document);
dict.Elements["/D"] = array;
PdfReference iref = PdfInternals.GetReference(document.Pages[2]);
array.Elements.Add(iref);
array.Elements.Add(new PdfName("/FitV"));
array.Elements.Add(new PdfInteger(-32768));
document.Internals.AddObject(dict);
document.Internals.Catalog.Elements["/OpenAction"] =
PdfInternals.GetReference(dict);
document.Save(filename);
Process.Start(filename);
}
}
}


Try this i think it will help you


http://social.msdn.microsoft.com/Forums/vstudio/en-US/a56b093b-2854-4925-99d5-2d35078c7cd3/converting-pdf-file-into-excel-file-using-c 一> [ ^ ]



访问此链接...
http://social.msdn.microsoft.com/Forums/vstudio/en-US/a56b093b-2854-4925-99d5-2d35078c7cd3/converting-pdf-file-into-excel-file-using-c[^]

visit this link...