Brief overview of simple usage of farpoint _ Practical Tips

Source: Internet
Author: User
Farpoint Operations Excel is very powerful, here a simple record of several farpoint usage.
1. Open Excel template
Copy Code code as follows:

This. Fpspread1.openexcel (Server.MapPath) (". /report/"+ strreport)); Open an Excel template
This. Fpspread1.sheets[0]. Allowpage = false; Whether pagination is displayed
This. Fpspread1.sheets[0]. Autocalculation = true; Whether to calculate formulas
This. Fpspread1.useclipboard = false; Can I use copy and paste
This. Fpspread1.sheets[0]. OperationMode = FarPoint.Web.Spread.OperationMode.RowMode; How the cell is operated (readable and writable)
This.FpSpread1.CommandBar.Visible = false; Whether to show toolbars

2. Save Excel Templates
Copy Code code as follows:

if (Fpspreadtemplate.saveexcel (Server.MapPath) ("..."). /"+ strFileName)" = = True)
{}

If you save the error. You can consider assigning everyone permissions to folders that manipulate Excel.
If it's still not working, you can consider configuring a folder (Fp_client) for your installed farpoint into your project, and then configuring the node in Webconfig
Copy Code code as follows:

<appSettings>
<add key= "fp_client" value= "Report/fp_client"/>
</appSettings>

The Fp_client folder is within the Farpoint root directory you have installed.
3. Operation Excel
Copy Code code as follows:

Open a template
Fpspreadtemplate.openexcel (Server.MapPath) (". /template/"+ Template));
Fpspreadtemplate.sheets[0]. Allowpage = false;
Fpspreadtemplate.sheets[0]. Autocalculation = true;
Looping rows and columns, traversing lattices
for (int irow = 0; IRow < fpspreadtemplate.sheets[0]. ROWCOUNT; irow++)
{
Traverse Excel based on columns
for (int icol = 0; Icol < fpspreadtemplate.sheets[0]. ColumnCount; icol++)
{
Get the text value in the corresponding grid
Strcurr = Fpspreadtemplate.sheets[0]. Cells[irow, Icol]. Text;
Assigning values to grid content
Fpspreadtemplate.sheets[0]. Cells[irow, Icol]. Text = "ABC";
}
}

4. Front desk Operation Excel
Copy Code code as follows:

Fpspread1_updatecommand Events using Farpoint
protected void Fpspread1_updatecommand (object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
if (fpspreadtemplate!= null)
{
Try
{
All columns of a row in this loop
for (int i = 0; i < E.editvalues.count; i++)
{
If the first column of the row is auto description This report needs to be automatically assigned in time
if (this. Fpspread1.sheets[0]. Cells[convert.toint32 (E.commandargument), 0]. text.tostring () = = "Auto")
{
#region
If the value is not currently edited
if (e.editvalues[i). ToString ()!= "System.Object")
{
}
#endregion
}
}
}
catch (Exception ex)
{
}
}
}

O (∩_∩) o make a little progress every day O (∩_∩) o this blog for personal record learning notes, if there are errors Welcome to point out!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.