Friday, January 27, 2023

Sample

using Syncfusion.XlsIO;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;


using Syncfusion.DocIO;

using Syncfusion.DocIO.DLS;


private void SyncFileDocDemo() 

        {

            //Creates an empty Word document instance

            WordDocument document = new WordDocument();

            //Loads or opens an existing word document through Open method of WordDocument class

            document.Open(Server.MapPath(@"SpreadSheet.docx"));


            document.Save(Server.MapPath("Result\\SpreadSheet.odt"), FormatType.Odt);

        }


        private void SyncFuExcelData() 

        {

            //Step 1 : Instantiate the spreadsheet creation engine.

            ExcelEngine excelEngine = new ExcelEngine();

            //Step 2 : Instantiate the excel application object.

            IApplication application = excelEngine.Excel;


            //A new workbook is created.[Equivalent to creating a new workbook in Microsoft Excel]

            //The new workbook will have 12 worksheets

            IWorkbook workbook = application.Workbooks.Open(Server.MapPath(@"SpreadSheet.xls"));


            string SaveOption = "Xls";

            try

            {

                //Saving the workbook to disk.

                if (SaveOption == "Xls")

                {

                    //Save as .xls format

                    workbook.SaveAs(Server.MapPath("Result\\SpreadSheet.ods"), HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel97);

                }

                //Save as .xlsx format

                else

                {

                    workbook.Version = ExcelVersion.Excel2016;

                    workbook.SaveAs("SpreadSheet.xlsx", HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel2016);

                }

            }

            catch (Exception)

            {

            }

        }

Monday, January 16, 2023

Generate Excel Bulk Report in Asp.Net With Extension method

To Generate the faster report for bulk data i used following code base for the download the data. Sample Code is :-

Supporting DLL is Click here (ClosedXML.dll)

 if (dtBase != null && dtBase.Rows.Count > 0)
        {
            if (dtBase.Rows.Count > 0)
            {
                dtBase.ExportExcel("VKYC_Report", "VKYC_Report");
            }
            else
            {
                lblError.Text = "Records not found.";
            }
        }
        else
        {
            lblError.Text = "Records not found.";
        }
-------------------------

public static class Extension
{
    public static void ExportExcel(this DataTable dt, string WorksheetName = "Report", string FileName = "Report")
    {
        try
        {
            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(dt, WorksheetName);
                if (HttpContext.Current != null)
                {
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Buffer = true;
                    HttpContext.Current.Response.Charset = "";
                    HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName + ".xlsx");
                    using (MemoryStream MyMemoryStream = new MemoryStream())
                    {
                        wb.SaveAs(MyMemoryStream);
                        MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream);
                        HttpContext.Current.Response.Flush();
                        HttpContext.Current.Response.End();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            // throw;
        }
    }
}

Friday, January 13, 2023

Some Dotnet Core Command

On Visual Studo you need to use below list of command for execution. dotnet new XX_Type XX_Name (First XX is type of project what you wanted to be create and another XX is name of project) dotnet build (Go to phisical directoy and type this command to build the application) dotnet run (To run/execute the application) donet publish XX_Location (XX is location where do you wanted to publish the code) to run the Publish file via commend line dotnet XXXX.dll (To execute the publish file you need to mention name of the file next to dotnet command)

Wednesday, January 4, 2023

Dynamic Create N level Navigation menu using JQuery and CSS

 For creating n level of dynamic navigation we required first data in JSON format.

Code base i will upload here.. including CSS and JS Complete code reference.


Working Code bundle is (Due to Code CSS application design is completed vanished ignore for outer design) Click Here for

Source Code and Preview is availble below




	
	
	
	


 




Jquery Loop for Object, Array Loop, Object loop, Sorting, Finding data in Nested array

 I found very good article here please visit here.

https://stackoverflow.com/questions/16626735/how-to-loop-through-an-array-containing-objects-and-access-their-properties