You are viewing limited content. For full access, please sign in.

Question

Question

Create New Excel sheet everytime user fill the forms

asked on October 28, 2019

How can i create new excel sheet and fill it from user forms and database every time user done fill the forms? 

0 0

Replies

replied on October 29, 2019

I use workflow to generate the excel document after form submission. I use tokens in my workflow to create the csv and then create the row data from form submission data.


Then you need to create the file with the following script

namespace WorkflowActivity.Scripting.CSVFileCreation0
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;
    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass102
    {
        private const string CSV_LINES_TOKEN = "%(CSV Lines#[]#)";
        private const string FILE_PATH_TOKEN = "%(File Path)";
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            // Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            var filePath = this.ReplaceTokensInString(FILE_PATH_TOKEN, true);
            var csvText = this.ReplaceTokensInString(CSV_LINES_TOKEN, true) + "\r\n";
            var csvData = System.Text.Encoding.UTF8.GetBytes(csvText);
            using (System.IO.FileStream file = System.IO.File.Create(filePath)) {
                file.Write(csvData, 0, csvData.Length);
            }
        }
    }
}
1 0
replied on March 29, 2023

Good morning Kathy,

 

I was hoping you could elaborate more on this process.  You are pulling fields from a submitted Laserfiche forms and creating a CSV file from those fields in Workflow Designer correct?

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.