We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove white space while generate pdf

im using aspose for generate pdf but for several data will show big white space
before new row
how to remove it ???
image.png (22.9 KB)

@yonathan41

Can you please share the source code and files so that we may try to reproduce the same on our end.

        Style style = workbook.CreateStyle();
        style.Font.Name = "DejaVu Sans";
        style.Font.Size = 8;
        style.IsTextWrapped = true;
        workbook.DefaultStyle = style;

worksheet.Cells[row, 0].Value = “Assets”;
Style subtitleStyle = worksheet.Cells[row, 0].GetStyle();
subtitleStyle.Font.IsBold = true;
worksheet.Cells[row, 0].SetStyle(subtitleStyle);
row++;
_ApplyStyle(worksheet, row, HEADER_STYLE, 14);
Style headerStyle = worksheet.Cells[row, 0].GetStyle();
headerStyle.Font.Color = Color.White;
worksheet.Cells[row, 0].Value = “Created Date”;
worksheet.Cells[row, 1].Value = “Billing Account ID”;
worksheet.Cells[row, 2].Value = “Billing Account Name”;
worksheet.Cells[row, 3].Value = “Assigned Cloud Admin”;
worksheet.Cells[row, 4].Value = “Cloud Admin Name”;
worksheet.Cells[row, 5].Value = “Tenant Code”;
worksheet.Cells[row, 6].Value = “Tenant Name”;
worksheet.Cells[row, 7].Value = “Compartment ID”;
worksheet.Cells[row, 8].Value = “Environment”;
worksheet.Cells[row, 9].Value = “CSP”;
worksheet.Cells[row, 10].Value = “CSP Billing Account Name”;
worksheet.Cells[row, 11].Value = “Hostname”;
worksheet.Cells[row, 12].Value = “Configuration”;
worksheet.Cells[row, 13].Value = “Asset Type”;
for (int i = 0; i < 14; i++)
{
worksheet.Cells[row, i].SetStyle(headerStyle);
}
row++;

        Style bodyStyle = worksheet.Cells[row, 0].GetStyle();
        bodyStyle.VerticalAlignment = TextAlignmentType.Top;

        foreach (var i in reportList)
        {
            worksheet.Cells[row, 0].Value = CommonUtility.UTCtoSGTDatetoString( i.AssetCreationDate);
            worksheet.Cells[row, 1].Value = i.BillingAccountID;
            worksheet.Cells[row, 2].Value = i.BillingAccountName;
            worksheet.Cells[row, 3].Value = i.CloudAdmin;
            worksheet.Cells[row, 4].Value = i.CloudAdminName;
            worksheet.Cells[row, 5].Value = i.TenantCode;
            worksheet.Cells[row, 6].Value = i.TenantName;
            worksheet.Cells[row, 7].Value = i.CompartmentId;
            worksheet.Cells[row, 8].Value = i.Environment;
            worksheet.Cells[row, 9].Value = i.CSP;
            worksheet.Cells[row, 10].Value = i.CSPBillingAccount;
            worksheet.Cells[row, 11].Value = i.HostName;
            worksheet.Cells[row, 12].Value = i.Configuration;
            worksheet.Cells[row, 13].Value = i.AssetType;
            for (int j = 0; j < 14; j++)
            {
                worksheet.Cells[row, j].SetStyle(bodyStyle);
            }
            row++;
        }
        return row + 2;

@yonathan41

I am moving this thread to Aspose.Cells forum where our concerned team will assist you further in this regard.

@yonathan41,

Your code segment is not enough to trace the issue on our end. Please create a standalone VS.NET console application and zip the project (you may exclude Aspose.Cells.Dll to minimize the size of the zipped archive) with all its resource files to reproduce the issue on our end. We will check it soon. Also, share your expected PDF file for our reference.

By the way, you may open your Excel file into MS Excel manually, set the data with styles and other options. Now take the print preview of sheet in MS Excel manually. Do you see different results comparing with the output PDF by Aspose.Cells? Please note, Aspose.Cells renders to PDF similar to worksheet’s display when taking it into Print Preview mode.