C#/VB.NET : convertir un PDF en PowerPoint
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
Les fichiers PDF sont parfaits pour être présentés sur différents types d'appareils et partagés sur plusieurs plates-formes, mais il faut admettre que l'édition de PDF est un peu difficile. Lorsque vous recevez un fichier PDF et que vous devez préparer une présentation basée sur le contenu qu'il contient, il est recommandé de convertir le fichier PDF en un document PowerPoint pour avoir un meilleur effet de présentation et également pour s'assurer que le contenu peut être modifié ultérieurement. Cet article vous montrera comment programmer convertir un PDF en présentation PowerPoint en utilisant Spire.PDF for .NET.
Installer Spire.PDF for .NET
Pour commencer, vous devez ajouter les fichiers DLL inclus dans le package Spire.PDF for .NET en tant que références dans votre projet .NET. Les fichiers DLL peuvent être téléchargés à partir de ce lien ou installés via NuGet.
PM> Install-Package Spire.PDF
Convertir un PDF en présentation PowerPoint en C# et VB.NET
À partir de la version 8.11.10, Spire.PDF for .NET prend en charge la conversion de PDF en PPTX à l'aide de la méthode PdfDocument.SaveToFile(). Avec cette méthode, chaque page de votre fichier PDF sera convertie en une seule diapositive dans PowerPoint. Vous trouverez ci-dessous les étapes pour convertir un fichier PDF en un document PowerPoint modifiable.
- Créez une instance PdfDocument.
- Chargez un exemple de document PDF à l'aide de la méthode PdfDocument.LoadFromFile().
- Enregistrez le document en tant que document PowerPoint à l'aide de la méthode PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

Demander une licence temporaire
Si vous souhaitez supprimer le message d'évaluation des documents générés ou vous débarrasser des limitations de la fonction, veuillez demander une licence d'essai de 30 jours pour toi.
C#/VB.NET: Converter PDF para Excel
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
PDF é um formato de arquivo versátil, mas é difícil de editar. Se você deseja modificar e calcular dados de PDF, a conversão de PDF para Excel seria uma solução ideal. Neste artigo, você aprenderá como converter PDF para Excel em C# e VB.NET usando o Spire.PDF for .NET.
Instalar o Spire.PDF for .NET
Para começar, você precisa adicionar os arquivos DLL incluídos no pacote Spire.PDF for.NET como referências em seu projeto .NET. Os arquivos DLL podem ser baixados deste link ou instalados via NuGet.
PM> Install-Package Spire.PDF
Converter PDF para Excel em C# e VB.NET
A seguir estão as etapas para converter um documento PDF em Excel:
- Inicialize uma instância da classe PdfDocument.
- Carregue o documento PDF usando o método PdfDocument.LoadFromFile(filePath).
- Salve o documento no Excel usando o método PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Converta um PDF de várias páginas em uma planilha do Excel em C# e VB.NET
A seguir estão as etapas para converter um PDF de várias páginas em uma planilha do Excel:
- Inicialize uma instância da classe PdfDocument.
- Carregue o documento PDF usando o método PdfDocument.LoadFromFile(filePath).
- Inicialize uma instância da classe XlsxLineLayoutOptions, no construtor da classe, definindo o primeiro parâmetro - convertToMultipleSheet como false.
- Defina opções de conversão de PDF para XLSX usando o método PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions).
- Salve o documento no Excel usando o método PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Solicitar uma licença temporária
Se você deseja remover a mensagem de avaliação dos documentos gerados ou se livrar das limitações de função, por favor solicite uma licença de teste de 30 dias para você mesmo.
C#/VB.NET: преобразование PDF в Excel
Оглавление
Установлено через NuGet
PM> Install-Package Spire.PDF
Ссылки по теме
PDF — это универсальный формат файлов, но его трудно редактировать. Если вы хотите изменить и рассчитать данные PDF, преобразование PDF в Excel будет идеальным решением. В этой статье вы узнаете, как конвертировать PDF в Excel на C# и VB.NET с помощью Spire.PDF for .NET.
Установите Spire.PDF for .NET
Для начала вам нужно добавить файлы DLL, включенные в пакет Spire.PDF for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить по этой ссылке или установить через NuGet.
PM> Install-Package Spire.PDF
Преобразование PDF в Excel на C# и VB.NET
Ниже приведены шаги для преобразования документа PDF в Excel:
- Инициализировать экземпляр класса PdfDocument.
- Загрузите документ PDF с помощью метода PdfDocument.LoadFromFile(filePath).
- Сохраните документ в Excel, используя метод PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Преобразование многостраничного PDF в один лист Excel в C# и VB.NET
Ниже приведены шаги для преобразования многостраничного PDF-файла в один лист Excel:
- Инициализировать экземпляр класса PdfDocument.
- Загрузите документ PDF с помощью метода PdfDocument.LoadFromFile(filePath).
- Инициализируйте экземпляр класса XlsxLineLayoutOptions в конструкторе класса, установив для первого параметра convertToMultipleSheet значение false.
- Задайте параметры преобразования PDF в XLSX с помощью метода PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions).
- Сохраните документ в Excel, используя метод PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, пожалуйста запросить 30-дневную пробную лицензию для себя.
C#/VB.NET: PDF in Excel konvertieren
Inhaltsverzeichnis
Über NuGet installiert
PM> Install-Package Spire.PDF
verwandte Links
PDF ist ein vielseitiges Dateiformat, das jedoch schwierig zu bearbeiten ist. Wenn Sie PDF-Daten ändern und berechnen möchten, wäre die Konvertierung von PDF in Excel eine ideale Lösung. In diesem Artikel erfahren Sie, wie das geht Konvertieren Sie PDF in Excel in C# und VB.NET Verwendung von Spire.PDF for .NET.
Installieren Spire.PDF for .NET
Zunächst müssen Sie die im Spire.PDF for.NET-Paket enthaltenen DLL-Dateien als Referenzen in Ihrem .NET-Projekt hinzufügen. Die DLL-Dateien können entweder über diesen Link heruntergeladen oder über NuGet installiert werden.
PM> Install-Package Spire.PDF
Konvertieren Sie PDF in Excel in C# und VB.NET
Im Folgenden finden Sie die Schritte zum Konvertieren eines PDF-Dokuments in Excel:
- Initialisieren Sie eine Instanz der PdfDocument-Klasse.
- Laden Sie das PDF-Dokument mit der Methode PdfDocument.LoadFromFile(filePath).
- Speichern Sie das Dokument mit der Methode PdfDocument.SaveToFile(filePath, FileFormat.XLSX) in Excel.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Konvertieren Sie eine mehrseitige PDF-Datei in ein Excel-Arbeitsblatt in C# und VB.NET
Im Folgenden finden Sie die Schritte zum Konvertieren einer mehrseitigen PDF-Datei in ein Excel-Arbeitsblatt:
- Initialisieren Sie eine Instanz der PdfDocument-Klasse.
- Laden Sie das PDF-Dokument mit der Methode PdfDocument.LoadFromFile(filePath).
- Initialisieren Sie eine Instanz der Klasse „XlsxLineLayoutOptions“ im Klassenkonstruktor und legen Sie den ersten Parameter „convertToMultipleSheet“ auf „false“ fest.
- Legen Sie PDF-zu-XLSX-Konvertierungsoptionen mit der Methode PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions) fest.
- Speichern Sie das Dokument mit der Methode PdfDocument.SaveToFile(filePath, FileFormat.XLSX) in Excel.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Beantragen Sie eine temporäre Lizenz
Wenn Sie die Bewertungsmeldung aus den generierten Dokumenten entfernen oder die Funktionseinschränkungen beseitigen möchten, wenden Sie sich bitte an uns Fordern Sie eine 30-Tage-Testlizenz an für sich selbst.
C#/VB.NET: Convertir PDF a Excel
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
PDF es un formato de archivo versátil, pero es difícil de editar. Si desea modificar y calcular datos PDF, la conversión de PDF a Excel sería una solución ideal. En este artículo, aprenderá cómo convertir PDF a Excel en C# y VB.NET usando Spire.PDF for .NET.
Instalar Spire.PDF for .NET
Para empezar, debe agregar los archivos DLL incluidos en el paquete Spire.PDF for .NET como referencias en su proyecto .NET. Los archivos DLL se pueden descargar desde este enlace o instalar a través de NuGet.
PM> Install-Package Spire.PDF
Convierta PDF a Excel en C# y VB.NET
Los siguientes son los pasos para convertir un documento PDF a Excel:
- Inicialice una instancia de la clase PdfDocument.
- Cargue el documento PDF usando el método PdfDocument.LoadFromFile(filePath).
- Guarde el documento en Excel usando el método PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Convierta un PDF de varias páginas en una hoja de cálculo de Excel en C# y VB.NET
Los siguientes son los pasos para convertir un PDF de varias páginas en una hoja de cálculo de Excel:
- Inicialice una instancia de la clase PdfDocument.
- Cargue el documento PDF usando el método PdfDocument.LoadFromFile(filePath).
- Inicialice una instancia de la clase XlsxLineLayoutOptions, en el constructor de la clase, configurando el primer parámetro, convertToMultipleSheet, como falso.
- Configure las opciones de conversión de PDF a XLSX mediante el método PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions).
- Guarde el documento en Excel usando el método PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Solicitar una Licencia Temporal
Si desea eliminar el mensaje de evaluación de los documentos generados o deshacerse de las limitaciones de la función, por favor solicitar una licencia de prueba de 30 días para ti.
C#/VB.NET: PDF를 Excel로 변환
NuGet을 통해 설치됨
PM> Install-Package Spire.PDF
관련된 링크들
PDF는 다목적 파일 형식이지만 편집하기가 어렵습니다. PDF 데이터를 수정하고 계산하려면 PDF를 Excel로 변환하는 것이 이상적인 솔루션입니다. 이 기사에서는 다음을 수행하는 방법을 배웁니다 C# 및 VB.NET에서 PDF를 Excel로 변환 Spire.PDF for .NET 사용.
Spire.PDF for .NET 설치
먼저 Spire.PDF for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 다음에서 다운로드할 수 있습니다 이 링크 또는 NuGet을 통해 설치됩니다.
PM> Install-Package Spire.PDF
C# 및 VB.NET에서 PDF를 Excel로 변환
다음은 PDF 문서를 Excel로 변환하는 단계입니다.
- PdfDocument 클래스의 인스턴스를 초기화합니다.
- PdfDocument.LoadFromFile(filePath) 메서드를 사용하여 PDF 문서를 로드합니다.
- PdfDocument.SaveToFile(filePath, FileFormat.XLSX) 메서드를 사용하여 문서를 Excel에 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

C# 및 VB.NET에서 다중 페이지 PDF를 하나의 Excel 워크시트로 변환
다음은 다중 페이지 PDF를 하나의 Excel 워크시트로 변환하는 단계입니다.
- PdfDocument 클래스의 인스턴스를 초기화합니다.
- PdfDocument.LoadFromFile(filePath) 메서드를 사용하여 PDF 문서를 로드합니다.
- 클래스 생성자에서 XlsxLineLayoutOptions 클래스의 인스턴스를 초기화하고 첫 번째 매개 변수인 convertToMultipleSheet를 false로 설정합니다.
- PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions) 메서드를 사용하여 PDF를 XLSX로 변환 옵션을 설정합니다.
- PdfDocument.SaveToFile(filePath, FileFormat.XLSX) 메서드를 사용하여 문서를 Excel에 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: Converti PDF in Excel
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
Il PDF è un formato di file versatile, ma è difficile da modificare. Se desideri modificare e calcolare i dati PDF, la conversione da PDF a Excel sarebbe la soluzione ideale. In questo articolo imparerai come convertire PDF in Excel in C# e VB.NET utilizzando Spire.PDF for .NET.
Installa Spire.PDF for .NET
Per cominciare, è necessario aggiungere i file DLL inclusi nel pacchetto Spire.PDF for .NET come riferimenti nel progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.PDF
Converti PDF in Excel in C# e VB.NET
Di seguito sono riportati i passaggi per convertire un documento PDF in Excel:
- Inizializza un'istanza della classe PdfDocument.
- Caricare il documento PDF utilizzando il metodo PdfDocument.LoadFromFile(filePath).
- Salvare il documento in Excel utilizzando il metodo PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Converti un PDF multipagina in un foglio di lavoro Excel in C# e VB.NET
Di seguito sono riportati i passaggi per convertire un PDF multipagina in un foglio di lavoro Excel:
- Inizializza un'istanza della classe PdfDocument.
- Caricare il documento PDF utilizzando il metodo PdfDocument.LoadFromFile(filePath).
- Inizializza un'istanza della classe XlsxLineLayoutOptions, nel costruttore della classe, impostando il primo parametro - convertToMultipleSheet come false.
- Imposta le opzioni di conversione da PDF a XLSX utilizzando il metodo PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions).
- Salvare il documento in Excel utilizzando il metodo PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni delle funzioni, per favore richiedere una licenza di prova di 30 giorni per te.
C#/VB.NET : convertir un PDF en Excel
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
Le PDF est un format de fichier polyvalent, mais il est difficile à modifier. Si vous souhaitez modifier et calculer des données PDF, la conversion de PDF en Excel serait une solution idéale. Dans cet article, vous apprendrez à convertir un PDF en Excel en C# et VB.NET à l'aide de Spire.PDF for .NET.
Installer Spire.PDF for .NET
Pour commencer, vous devez ajouter les fichiers DLL inclus dans le package Spire.PDF for .NET en tant que références dans votre projet .NET. Les fichiers DLL peuvent être téléchargés à partir de ce lien ou installés via NuGet.
PM> Install-Package Spire.PDF
Convertir PDF en Excel en C# et VB.NET
Voici les étapes pour convertir un document PDF en Excel :
- Initialiser une instance de la classe PdfDocument.
- Chargez le document PDF à l'aide de la méthode PdfDocument.LoadFromFile(filePath).
- Enregistrez le document dans Excel à l'aide de la méthode PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample.pdf");
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX);
}
}
}

Convertir un PDF multipage en une feuille de calcul Excel en C# et VB.NET
Voici les étapes pour convertir un PDF de plusieurs pages en une seule feuille de calcul Excel :
- Initialiser une instance de la classe PdfDocument.
- Chargez le document PDF à l'aide de la méthode PdfDocument.LoadFromFile(filePath).
- Initialisez une instance de la classe XlsxLineLayoutOptions, dans le constructeur de classe, en définissant le premier paramètre - convertToMultipleSheet sur false.
- Définissez les options de conversion PDF vers XLSX à l'aide de la méthode PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions).
- Enregistrez le document dans Excel à l'aide de la méthode PdfDocument.SaveToFile(filePath, FileFormat.XLSX).
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Conversion;
namespace ConvertPdfToExcel
{
class Program
{
static void Main(string[] args)
{
//Initialize an instance of PdfDocument class
PdfDocument pdf = new PdfDocument();
//Load the PDF document
pdf.LoadFromFile("Sample1.pdf");
//Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
//The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText
XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true);
//Set PDF to XLSX convert options
pdf.ConvertOptions.SetPdfToXlsxOptions(options);
//Save the PDF document to XLSX
pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX);
}
}
}

Demander une licence temporaire
Si vous souhaitez supprimer le message d'évaluation des documents générés ou vous débarrasser des limitations de la fonction, veuillez demander une licence d'essai de 30 jours pour toi.
C#/VB.NET: Converter Word para Excel
Instalado via NuGet
PM> Install-Package Spire.Office
Links Relacionados
Word e Excel são dois tipos de arquivo completamente diferentes. Os documentos do Word são usados para redigir ensaios, cartas ou criar relatórios, enquanto os documentos do Excel são usados para salvar dados em formato tabular, fazer gráficos ou realizar cálculos matemáticos. Não é recomendado converter um documento complexo do Word em uma planilha do Excel porque o Excel dificilmente pode renderizar o conteúdo de acordo com seu layout original no Word.
No entanto, se o seu documento do Word for composto principalmente de tabelas e você quiser analisar os dados da tabela no Excel, poderá usar o Spire.Office for .NET para converter Word para Excel enquanto mantendo uma boa legibilidade.
Instalar o Spire.Office for .NET
Para começar, você precisa adicionar os arquivos DLL incluídos no pacote Spire.Office for .NET como referências em seu projeto .NET. Os arquivos DLL podem ser baixados deste link ou instalado via NuGet.
PM> Install-Package Spire.Office
Converter Word para Excel em C# e VB.NET
Na verdade, esse cenário usa duas bibliotecas no pacote Spire.Office. Eles são Spire.Doc for .NET e Spire.XLS for .NET. O primeiro é usado para ler e extrair conteúdo de um documento do Word, e o segundo é usado para criar um documento do Excel e gravar dados nas células específicas. Para tornar este exemplo de código fácil de entender, criamos os três métodos personalizados a seguir que executam funções específicas.
- ExportTableInExcel() - Exporta dados de uma tabela do Word para células especificadas do Excel.
- CopyContentInTable() - CopyContentInTable() - Copia o conteúdo de uma célula de tabela no Word para uma célula do Excel.
- CopyTextAndStyle() - CopyTextAndStyle() - Copia texto com formatação de um parágrafo do Word para uma célula do Excel.
As etapas a seguir demonstram como exportar dados de um documento inteiro do Word para uma planilha usando o Spire.Office for .NET.
- Crie um objeto Documento para carregar um arquivo do Word.
- Crie um objeto Worbbook e adicione uma planilha chamada "WordToExcel" a ele.
- Percorra todas as seções no documento do Word, percorra todos os objetos de documento em uma determinada seção e determine se um objeto de documento é um parágrafo ou uma tabela.
- Se o objeto do documento for um parágrafo, escreva o parágrafo em uma célula especificada no Excel usando o método CoypTextAndStyle().
- Se o objeto do documento for uma tabela, exporte os dados da tabela de células do Word para Excel usando o método ExportTableInExcel().
- Ajuste automaticamente a altura da linha e a largura da coluna no Excel para que os dados dentro de uma célula não excedam o limite da célula.
- Salve a pasta de trabalho em um arquivo do Excel usando o método Workbook.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
using Spire.Xls;
using System;
using System.Drawing;
namespace ConvertWordToExcel
{
class Program
{
static void Main(string[] args)
{
//Create a Document object
Document doc = new Document();
//Load a Word file
doc.LoadFromFile(@"C:\Users\Administrator\Desktop\Invoice.docx");
//Create a Workbook object
Workbook wb = new Workbook();
//Remove the default worksheets
wb.Worksheets.Clear();
//Create a worksheet named "WordToExcel"
Worksheet worksheet = wb.CreateEmptySheet("WordToExcel");
int row = 1;
int column = 1;
//Loop through the sections in the Word document
foreach (Section section in doc.Sections)
{
//Loop through the document object under a certain section
foreach (DocumentObject documentObject in section.Body.ChildObjects)
{
//Determine if the object is a paragraph
if (documentObject is Paragraph)
{
CellRange cell = worksheet.Range[row, column];
Paragraph paragraph = documentObject as Paragraph;
//Copy paragraph from Word to a specific cell
CopyTextAndStyle(cell, paragraph);
row++;
}
//Determine if the object is a table
if (documentObject is Table)
{
Table table = documentObject as Table;
//Export table data from Word to Excel
int currentRow = ExportTableInExcel(worksheet, row, table);
row = currentRow;
}
}
}
//Auto fit row height and column width
worksheet.AllocatedRange.AutoFitRows();
worksheet.AllocatedRange.AutoFitColumns();
//Wrap text in cells
worksheet.AllocatedRange.IsWrapText = true;
//Save the workbook to an Excel file
wb.SaveToFile("WordToExcel.xlsx", ExcelVersion.Version2013);
}
//Export data from Word table to Excel cells
private static int ExportTableInExcel(Worksheet worksheet, int row, Table table)
{
CellRange cell;
int column;
foreach (TableRow tbRow in table.Rows)
{
column = 1;
foreach (TableCell tbCell in tbRow.Cells)
{
cell = worksheet.Range[row, column];
cell.BorderAround(LineStyleType.Thin, Color.Black);
CopyContentInTable(tbCell, cell);
column++;
}
row++;
}
return row;
}
//Copy content from a Word table cell to an Excel cell
private static void CopyContentInTable(TableCell tbCell, CellRange cell)
{
Paragraph newPara = new Paragraph(tbCell.Document);
for (int i = 0; i < tbCell.ChildObjects.Count; i++)
{
DocumentObject documentObject = tbCell.ChildObjects[i];
if (documentObject is Paragraph)
{
Paragraph paragraph = documentObject as Paragraph;
foreach (DocumentObject cObj in paragraph.ChildObjects)
{
newPara.ChildObjects.Add(cObj.Clone());
}
if (i < tbCell.ChildObjects.Count - 1)
{
newPara.AppendText("\n");
}
}
}
CopyTextAndStyle(cell, newPara);
}
//Copy text and style of a paragraph to a cell
private static void CopyTextAndStyle(CellRange cell, Paragraph paragraph)
{
RichText richText = cell.RichText;
richText.Text = paragraph.Text;
int startIndex = 0;
foreach (DocumentObject documentObject in paragraph.ChildObjects)
{
if (documentObject is TextRange)
{
TextRange textRange = documentObject as TextRange;
string fontName = textRange.CharacterFormat.FontName;
bool isBold = textRange.CharacterFormat.Bold;
Color textColor = textRange.CharacterFormat.TextColor;
float fontSize = textRange.CharacterFormat.FontSize;
string textRangeText = textRange.Text;
int strLength = textRangeText.Length;
ExcelFont font = cell.Worksheet.Workbook.CreateFont();
font.Color = textColor;
font.IsBold = isBold;
font.Size = fontSize;
font.FontName = fontName;
int endIndex = startIndex + strLength;
richText.SetFont(startIndex, endIndex, font);
startIndex += strLength;
}
if (documentObject is DocPicture)
{
DocPicture picture = documentObject as DocPicture;
cell.Worksheet.Pictures.Add(cell.Row, cell.Column, picture.Image);
cell.Worksheet.SetRowHeightInPixels(cell.Row, 1, picture.Image.Height);
}
}
switch (paragraph.Format.HorizontalAlignment)
{
case HorizontalAlignment.Left:
cell.Style.HorizontalAlignment = HorizontalAlignType.Left;
break;
case HorizontalAlignment.Center:
cell.Style.HorizontalAlignment = HorizontalAlignType.Center;
break;
case HorizontalAlignment.Right:
cell.Style.HorizontalAlignment = HorizontalAlignType.Right;
break;
}
}
}
}

Solicitar uma licença temporária
Se você deseja remover a mensagem de avaliação dos documentos gerados ou se livrar das limitações de função, por favor solicite uma licença de teste de 30 dias para você mesmo.
C#/VB.NET: преобразование Word в Excel
Оглавление
Установлено через NuGet
PM> Install-Package Spire.Office
Ссылки по теме
Word и Excel — это два совершенно разных типа файлов. Документы Word используются для написания эссе, писем или создания отчетов, а документы Excel используются для сохранения данных в табличной форме, построения диаграмм или выполнения математических расчетов. Не рекомендуется преобразовывать сложный документ Word в электронную таблицу Excel, поскольку Excel едва ли может отображать содержимое в соответствии с его исходным макетом в Word.
Однако если ваш документ Word в основном состоит из таблиц и вы хотите проанализировать табличные данные в Excel, вы можете использовать Spire.Office for .NET для конвертировать ворд в эксель пока сохранение хорошей читабельности.
Установите Spire.Office for .NET
Для начала вам необходимо добавить файлы DLL, включенные в пакет Spire.Office for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить с эта ссылка или установлен через NuGet.
PM> Install-Package Spire.Office
Преобразование Word в Excel в C# и VB.NET
Этот сценарий фактически использует две библиотеки в пакете Spire.Office. Это Spire.Doc for .NET и Spire.XLS for .NET. Первый используется для чтения и извлечения содержимого из документа Word, а второй используется для создания документа Excel и записи данных в определенные ячейки. Чтобы упростить понимание этого примера кода, мы создали следующие три пользовательских метода, которые выполняют определенные функции.
- ExportTableInExcel() - Экспорт данных из таблицы Word в указанные ячейки Excel.
- CopyContentInTable() - копирование содержимого из ячейки таблицы Word в ячейку Excel.
- CopyTextAndStyle() - копирование текста с форматированием из абзаца Word в ячейку Excel.
Следующие шаги демонстрируют, как экспортировать данные из всего документа Word на лист с помощью Spire.Office for .NET.
- Создайте объект Document для загрузки файла Word.
- Создайте объект Worbbook и добавьте в него рабочий лист с именем «WordToExcel».
- Просмотрите все разделы в документе Word, просмотрите все объекты документа в определенном разделе, а затем определите, является ли объект документа абзацем или таблицей.
- Если объект документа представляет собой абзац, напишите абзац в указанной ячейке Excel с помощью метода CoypTextAndStyle().
- Если объект документа представляет собой таблицу, экспортируйте данные таблицы из Word в ячейки Excel с помощью метода ExportTableInExcel().
- Автоматически подбирайте высоту строки и ширину столбца в Excel, чтобы данные в ячейке не превышали границу ячейки.
- Сохраните книгу в файл Excel, используя метод Workbook.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
using Spire.Xls;
using System;
using System.Drawing;
namespace ConvertWordToExcel
{
class Program
{
static void Main(string[] args)
{
//Create a Document object
Document doc = new Document();
//Load a Word file
doc.LoadFromFile(@"C:\Users\Administrator\Desktop\Invoice.docx");
//Create a Workbook object
Workbook wb = new Workbook();
//Remove the default worksheets
wb.Worksheets.Clear();
//Create a worksheet named "WordToExcel"
Worksheet worksheet = wb.CreateEmptySheet("WordToExcel");
int row = 1;
int column = 1;
//Loop through the sections in the Word document
foreach (Section section in doc.Sections)
{
//Loop through the document object under a certain section
foreach (DocumentObject documentObject in section.Body.ChildObjects)
{
//Determine if the object is a paragraph
if (documentObject is Paragraph)
{
CellRange cell = worksheet.Range[row, column];
Paragraph paragraph = documentObject as Paragraph;
//Copy paragraph from Word to a specific cell
CopyTextAndStyle(cell, paragraph);
row++;
}
//Determine if the object is a table
if (documentObject is Table)
{
Table table = documentObject as Table;
//Export table data from Word to Excel
int currentRow = ExportTableInExcel(worksheet, row, table);
row = currentRow;
}
}
}
//Auto fit row height and column width
worksheet.AllocatedRange.AutoFitRows();
worksheet.AllocatedRange.AutoFitColumns();
//Wrap text in cells
worksheet.AllocatedRange.IsWrapText = true;
//Save the workbook to an Excel file
wb.SaveToFile("WordToExcel.xlsx", ExcelVersion.Version2013);
}
//Export data from Word table to Excel cells
private static int ExportTableInExcel(Worksheet worksheet, int row, Table table)
{
CellRange cell;
int column;
foreach (TableRow tbRow in table.Rows)
{
column = 1;
foreach (TableCell tbCell in tbRow.Cells)
{
cell = worksheet.Range[row, column];
cell.BorderAround(LineStyleType.Thin, Color.Black);
CopyContentInTable(tbCell, cell);
column++;
}
row++;
}
return row;
}
//Copy content from a Word table cell to an Excel cell
private static void CopyContentInTable(TableCell tbCell, CellRange cell)
{
Paragraph newPara = new Paragraph(tbCell.Document);
for (int i = 0; i < tbCell.ChildObjects.Count; i++)
{
DocumentObject documentObject = tbCell.ChildObjects[i];
if (documentObject is Paragraph)
{
Paragraph paragraph = documentObject as Paragraph;
foreach (DocumentObject cObj in paragraph.ChildObjects)
{
newPara.ChildObjects.Add(cObj.Clone());
}
if (i < tbCell.ChildObjects.Count - 1)
{
newPara.AppendText("\n");
}
}
}
CopyTextAndStyle(cell, newPara);
}
//Copy text and style of a paragraph to a cell
private static void CopyTextAndStyle(CellRange cell, Paragraph paragraph)
{
RichText richText = cell.RichText;
richText.Text = paragraph.Text;
int startIndex = 0;
foreach (DocumentObject documentObject in paragraph.ChildObjects)
{
if (documentObject is TextRange)
{
TextRange textRange = documentObject as TextRange;
string fontName = textRange.CharacterFormat.FontName;
bool isBold = textRange.CharacterFormat.Bold;
Color textColor = textRange.CharacterFormat.TextColor;
float fontSize = textRange.CharacterFormat.FontSize;
string textRangeText = textRange.Text;
int strLength = textRangeText.Length;
ExcelFont font = cell.Worksheet.Workbook.CreateFont();
font.Color = textColor;
font.IsBold = isBold;
font.Size = fontSize;
font.FontName = fontName;
int endIndex = startIndex + strLength;
richText.SetFont(startIndex, endIndex, font);
startIndex += strLength;
}
if (documentObject is DocPicture)
{
DocPicture picture = documentObject as DocPicture;
cell.Worksheet.Pictures.Add(cell.Row, cell.Column, picture.Image);
cell.Worksheet.SetRowHeightInPixels(cell.Row, 1, picture.Image.Height);
}
}
switch (paragraph.Format.HorizontalAlignment)
{
case HorizontalAlignment.Left:
cell.Style.HorizontalAlignment = HorizontalAlignType.Left;
break;
case HorizontalAlignment.Center:
cell.Style.HorizontalAlignment = HorizontalAlignType.Center;
break;
case HorizontalAlignment.Right:
cell.Style.HorizontalAlignment = HorizontalAlignType.Right;
break;
}
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, пожалуйста запросить 30-дневную пробную лицензию для себя.