Soporte de IronXL para AWS Lambda Function con .NET Core

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronXL es totalmente compatible con AWS Lambda Function para bibliotecas .NET Standard, aplicaciones Core y proyectos .NET 5 y .NET 6.

Para añadir AWS ToolKit para visual studio sigue este enlaceUso de las plantillas de AWS Lambda en el kit de herramientas de AWS para Visual Studio

La instalación de AWS ToolKit en Visual studio permite crear un proyecto de función AWS Lambda. Usted puede aprender cómo crear AWS Lambda Función del proyecto utilizando Visual Studio con esteEnlace

Ejemplo de código de función AWS Lambda

Después de crear el nuevo proyecto AWS Lambda Function, prueba este fragmento de código

    namespace AWSLambdaIronXL
    {
        public class Function
        {

        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public string FunctionHandler(string input, ILambdaContext context)
        {
            WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLS);

            var newSheet = workBook.CreateWorkSheet("new_sheet");
            string ColumnsNames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            foreach (char col in ColumnsNames)
            {
                for (int row = 1; row <= 50; row++)
                {
                    var cellName = $"{col}{row}";
                    newSheet [cellName].Value = $"Cell : {cellName}";
                }
            }

            return Convert.ToBase64String( workBook.ToByteArray());
        }
        }
    }
    namespace AWSLambdaIronXL
    {
        public class Function
        {

        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public string FunctionHandler(string input, ILambdaContext context)
        {
            WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLS);

            var newSheet = workBook.CreateWorkSheet("new_sheet");
            string ColumnsNames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            foreach (char col in ColumnsNames)
            {
                for (int row = 1; row <= 50; row++)
                {
                    var cellName = $"{col}{row}";
                    newSheet [cellName].Value = $"Cell : {cellName}";
                }
            }

            return Convert.ToBase64String( workBook.ToByteArray());
        }
        }
    }
Namespace AWSLambdaIronXL
		Public Class [Function]

		''' <summary>
		''' A simple function that takes a string and does a ToUpper
		''' </summary>
		''' <param name="input"></param>
		''' <param name="context"></param>
		''' <returns></returns>
		Public Function FunctionHandler(ByVal input As String, ByVal context As ILambdaContext) As String
			Dim workBook As WorkBook = WorkBook.Create(ExcelFileFormat.XLS)

			Dim newSheet = workBook.CreateWorkSheet("new_sheet")
			Dim ColumnsNames As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
			For Each col As Char In ColumnsNames
				For row As Integer = 1 To 50
					Dim cellName = $"{col}{row}"
					newSheet (cellName).Value = $"Cell : {cellName}"
				Next row
			Next col

			Return Convert.ToBase64String(workBook.ToByteArray())
		End Function
		End Class
End Namespace
VB   C#

IronXL NuGet Paquetes disponibles para despliegues documentados en nuestroGuía de instalación de IronXL NuGet.