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 );
}
}
}
}
}
}
}
}
}