Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri May 12, 2023 6:38 am

Sample data: https://drive.google.com/file/d/1qWXnDT ... sp=sharing
Code using Ver 9.4.12:
Code: Select all
string strTargetPage = @"D:\admin\SpirePDF\testable2.pdf";     
            Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();           
            doc.LoadFromFile(strTargetPage);
            PdfTableExtractor extractor = new PdfTableExtractor(doc);           
            PdfTable[] tableLists = extractor.ExtractTable(0);
            //Determine if the table list is null
            if (tableLists != null && tableLists.Length > 0)
            {
                //Loop through the table in the list
                foreach (PdfTable table in tableLists)
                {
                    //Get row number and column number of a certain table
                    int iTotalRow = table.GetRowCount();
                    int iTotalCol = table.GetColumnCount();
                    //OutputExcel
                 
                        Workbook workbook = new Workbook();
                       workbook.CreateEmptySheets(1);
                       Worksheet sheet = workbook.Worksheets[0];

                        //Loop though the row and colunm
                        for (int iRow = 0; iRow < iTotalRow; iRow++)
                        {
                            for (int iCol = 0; iCol < iTotalCol; iCol++)
                            {
                                //Get text from the specific cell
                                string text = table.GetText(iRow, iCol);
                               sheet.Range[iRow + 1, iCol + 1].Value = text;

                             
                            }
                           
                        }
                       

                     
                        //Save your file
                        string strExcel = strTargetPage + "_" + DateTime.Now.ToString("yyyyMMddHHmmss.fff") + ".xlsx";                       
                        workbook.SaveToFile(strExcel);                     
                   

                }
            }

Table:
t21.png

Result:
t22.png

daitranthanhhoa
 
Posts: 51
Joined: Mon Sep 19, 2016 3:04 am

Fri May 12, 2023 9:15 am

Hi,

Thanks for your feedback.
After testing, I have reproduced your issue, see attached screenshot.
issue.png

These lines have moved up. I have logged this issue into our issue tracking system with the ticket number SPIREPDF-6000, our developers will investigate and fix it, sorry for the inconvenience caused, once the issue is fixed, I will inform you asap.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed Jun 07, 2023 8:53 am

Hi,

Thanks for your patience.
Glad to inform you that we have released Spire.PDF 9.6.0 hotfix, which has fixed your issue SPIREPDF-6000. Please note that we have adjusted the licensing method since this new version, see the following code for reference.
Code: Select all
Spire.Pdf.License.LicenseProvider.SetLicenseKey("");

Website: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget: https://www.nuget.org/packages/Spire.PDF/9.6.0

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF

cron