VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
Кодеки: Как установить параметры макета XLSX-документа?
В этом разделе
SDK позволяет указать настройки макета (размер страницы, отступы страницы, масштаб содержимого) XLSX-документа. Настройки макета страницы можно указать для всех страниц, четных и/или нечетных страниц, страниц указанных индексами.

Вот C#/VB.NET код, который демонстрирует, как установить параметры макета XLSX-документа:
/// <summary>
/// Class shows how to convert XLSX document to PDF document using specified layout settings.
/// </summary>
public class XlsxConverter
{

    /// <summary>
    /// Converts XLSX document to PDF document using specified layout settings.
    /// </summary>
    public static void ConvertXlsxToPdf(string xlsxFileName, string pdfFileName)
    {
        // create image collection
        using (Vintasoft.Imaging.ImageCollection imageCollection = new Vintasoft.Imaging.ImageCollection())
        {
            // subscribe to the ImageCollection.LayoutSettingsRequest event
            imageCollection.LayoutSettingsRequest += ImageCollection_LayoutSettingsRequest;

            // add XLSX document to the image collection
            imageCollection.Add(xlsxFileName);

            // create PDF encoder that will create new PDF file
            using (Vintasoft.Imaging.Codecs.Encoders.PdfEncoder pdfEncoder = 
                new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true))
            {
                // save images of image collection to PDF document using PDF encoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder);
            }

            // dispose images
            imageCollection.ClearAndDisposeItems();
        }
    }

    /// <summary>
    /// Handles the LayoutSettingsRequest event of the ImageCollection object.
    /// </summary>
    private static void ImageCollection_LayoutSettingsRequest(object sender, Vintasoft.Imaging.DocumentLayoutSettingsRequestEventArgs e)
    {
        // if XLSX codec is used
        if (e.Codec.Name == "Xlsx")
        {
            // change layout settings of XLSX document
 
           Vintasoft.Imaging.Codecs.Decoders.XlsxDocumentLayoutSettings layoutSettings = (Vintasoft.Imaging.Codecs.Decoders.XlsxDocumentLayoutSettings)e.LayoutSettings;

            // set page width to worksheet width
            layoutSettings.PageLayoutSettingsType |= Vintasoft.Imaging.Codecs.Decoders.XlsxPageLayoutSettingsType.UseWorksheetWidth;

            // set page height to A4
            layoutSettings.PageLayoutSettings = new Vintasoft.Imaging.Codecs.Decoders.PageLayoutSettings(Vintasoft.Imaging.ImageSize.FromPaperKind(Vintasoft.Imaging.PaperSizeKind.A4));
        }
    }
}
''' <summary>
''' Class shows how to convert XLSX document to PDF document using specified layout settings.
''' </summary>
Public Class XlsxConverter

    ''' <summary>
    ''' Converts XLSX document to PDF document using specified layout settings.
    ''' </summary>
    Public Shared Sub ConvertXlsxToPdf(xlsxFileName As String, pdfFileName As String)
        ' create image collection
        Using imageCollection As New Vintasoft.Imaging.ImageCollection()
            ' subscribe to the ImageCollection.LayoutSettingsRequest event
            AddHandler imageCollection.LayoutSettingsRequest, AddressOf ImageCollection_LayoutSettingsRequest

            ' add XLSX document to the image collection
            imageCollection.Add(xlsxFileName)

            ' create PDF encoder that will create new PDF file
            Using pdfEncoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
                ' save images of image collection to PDF document using PDF encoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder)
            End Using

            ' dispose images
            imageCollection.ClearAndDisposeItems()
        End Using
    End Sub

    ''' <summary>
    ''' Handles the LayoutSettingsRequest event of the ImageCollection object.
    ''' </summary>
    Private Shared Sub ImageCollection_LayoutSettingsRequest(sender As Object, e As Vintasoft.Imaging.DocumentLayoutSettingsRequestEventArgs)
        ' if XLSX codec is used
        If e.Codec.Name = "Xlsx" Then
            ' change layout settings of XLSX document

            Dim layoutSettings As Vintasoft.Imaging.Codecs.Decoders.XlsxDocumentLayoutSettings = DirectCast(e.LayoutSettings, Vintasoft.Imaging.Codecs.Decoders.XlsxDocumentLayoutSettings)

            ' set page width to worksheet width
            layoutSettings.PageLayoutSettingsType = layoutSettings.PageLayoutSettingsType Or Vintasoft.Imaging.Codecs.Decoders.XlsxPageLayoutSettingsType.UseWorksheetWidth

            ' set page height to A4
            layoutSettings.PageLayoutSettings = New Vintasoft.Imaging.Codecs.Decoders.PageLayoutSettings(Vintasoft.Imaging.ImageSize.FromPaperKind(Vintasoft.Imaging.PaperSizeKind.A4))
        End If
    End Sub
End Class