ASP. NET implementation thread passes multiple parameters ............. (And use threads to dynamically replace bookmarks in word)

Source: Internet
Author: User

 

Using system. IO;
Using system. Threading;


Threadoutput to1 =   New Threadoutput ();
To1.picname = PIC;
To1.companyname = Company;
To1.chuname = Chu;
To1.traid = Traid;
Thread tthread =   New Thread ( New Threadstart (to1.wordsaveas ));
// Set as the background thread, mainly for the end of the main thread without affecting
Tthread. isbackground =   True ;
Tthread. Start ();

// *******************
Public   Class Threadoutput
{
String PIC =   "" ; // Head up image
String Company =   "" ; // Name
Int Travelid =   - 1 ; // ID
String Chu =   "" ; // Name

///   <Summary>
/// Head up image
///   </Summary>
Public   String Picname
{
Set {PIC = Value ;}
}
///   <Summary>
/// Name
///   </Summary>
Public   String CompanyName
{
Set {Company = Value ;}
}
///   <Summary>
/// ID
///   </Summary>
Public   Int Tralid
{
Set {Travelid = Value ;}
}
///   <Summary>
/// Office name
///   </Summary>
Public   String Chuname
{
Set {Banshichu = Value ;}
}

///   <Summary>
/// Characters to be separated
///   </Summary>
///   <Param name = "TXT"> Delimiter </Param>
///   <Param name = "Lex"> Value </Param>
///   <Returns> </returns>
Public   String Splittext ( Object TXT, Int Lex)
{
String Label = TXT. tostring ();
If (Label ! =   "" )
{
String [] Strarr = Label. Split ( ' & ' );

If (Strarr. Length > = Lex)
Return Strarr [Lex]. tostring ();
Else
Return   "" ;
}
Else
{
Return   "" ;
}
}

// Additional storage head
Public   Void Wordsaveas ()
{

// Get file list
String SD = Appdomain. currentdomain. basedirectory +   " Travel_new \ doc \\ " ;
String [] Files = Directory. getfiles (SD );

Foreach ( String F In Files)
{
If (F. lastindexof ( " \\ " ) ! =   - 1 )
{
String Strfile = F. substring (F. lastindexof ( " \\ " ) +   1 );
String Strlast = Strfile. substring (strfile. Length -   3 , 3 );
If (Strlast. tolower () =   " Doc " )
{
String Strname = Strfile. substring ( 0 , Strfile. Length -   4 );
String Filename = Strname +   " . Doc " ; // File name saved by the client
String Filepath = Appdomain. currentdomain. basedirectory +   " Travel_new \ doc \\ "   + Filename; // Path
If (Company ! =   "" )
{
// Determine whether the itinerary document exists. If the document does not exist, create an alternative document. Otherwise, call the existing logo document.
If (File. exists (appdomain. currentdomain. basedirectory +   " Travel_new \ doc \ logo \\ "   + Strname +   " _ "   + Company +   " _Logo.doc " ) =   False )
{
If (PIC ! =   "" )
{
If (File. exists (appdomain. currentdomain. basedirectory +   @" \ "   + PIC ))
{
// Replace the logo and save it as a new document.
Outputwod. creatworddocument (strname, filepath, filename, PIC, company );
}
}
}
}
}
}
}

}
}

 

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.