Metoda DocumentBase.CreateLetterContent —
Tworzy i zwraca LetterContent obiektu opierając się na elementach określonej litery.
Przestrzeń nazw: Microsoft.Office.Tools.Word
Zestaw: Microsoft.Office.Tools.Word.v4.0.Utilities (w Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
Składnia
'Deklaracja
Public Function CreateLetterContent ( _
dateFormat As String, _
includeHeaderFooter As Boolean, _
pageDesign As String, _
letterStyle As WdLetterStyle, _
letterhead As Boolean, _
letterheadLocation As WdLetterheadLocation, _
letterheadSize As Single, _
recipientName As String, _
recipientAddress As String, _
salutation As String, _
salutationType As WdSalutationType, _
recipientReference As String, _
mailingInstructions As String, _
attentionLine As String, _
subject As String, _
cCList As String, _
returnAddress As String, _
senderName As String, _
closing As String, _
senderCompany As String, _
senderJobTitle As String, _
senderInitials As String, _
enclosureNumber As Integer, _
ByRef infoBlock As Object, _
ByRef recipientCode As Object, _
ByRef recipientGender As Object, _
ByRef returnAddressShortForm As Object, _
ByRef senderCity As Object, _
ByRef senderCode As Object, _
ByRef senderGender As Object, _
ByRef senderReference As Object _
) As LetterContent
public LetterContent CreateLetterContent(
string dateFormat,
bool includeHeaderFooter,
string pageDesign,
WdLetterStyle letterStyle,
bool letterhead,
WdLetterheadLocation letterheadLocation,
float letterheadSize,
string recipientName,
string recipientAddress,
string salutation,
WdSalutationType salutationType,
string recipientReference,
string mailingInstructions,
string attentionLine,
string subject,
string cCList,
string returnAddress,
string senderName,
string closing,
string senderCompany,
string senderJobTitle,
string senderInitials,
int enclosureNumber,
ref Object infoBlock,
ref Object recipientCode,
ref Object recipientGender,
ref Object returnAddressShortForm,
ref Object senderCity,
ref Object senderCode,
ref Object senderGender,
ref Object senderReference
)
Parametry
- dateFormat
Typ: System.String
Data listu.
- includeHeaderFooter
Typ: System.Boolean
true Aby dołączyć nagłówka i stopki z szablonu projektu strony.
- pageDesign
Typ: System.String
Nazwa szablonu dołączonego do dokumentu.
- letterStyle
Typ: Microsoft.Office.Interop.Word.WdLetterStyle
Element WdLetterStyle.Układ dokumentu.
- letterhead
Typ: System.Boolean
true Aby zarezerwować miejsce dla wstępnie zadrukowany nagłówek listowy.
- letterheadLocation
Typ: Microsoft.Office.Interop.Word.WdLetterheadLocation
Element WdLetterheadLocation.Lokalizacja wstępnie zadrukowany nagłówek listowy.
- letterheadSize
Typ: System.Single
Ilość miejsca (w punktach) ma być zastrzeżony do wstępnie zadrukowany nagłówek listowy.
- recipientName
Typ: System.String
Nazwa osoby otrzymującej literę.
- recipientAddress
Typ: System.String
Adres wysyłkowy osobę otrzymującą literę.
- salutation
Typ: System.String
Tekst powitania litery.
- salutationType
Typ: Microsoft.Office.Interop.Word.WdSalutationType
Element WdSalutationType.Typ zwrotu grzecznościowego litery.
- recipientReference
Typ: System.String
Tekst wiersza odwołania litery (na przykład "w odpowiedzi na:").
- mailingInstructions
Typ: System.String
Tekst instrukcji korespondencji litery (na przykład "Certified Mail").
- attentionLine
Typ: System.String
Tekst wiersza uwagę litery (na przykład "Uwagi:").
- subject
Typ: System.String
Tekst tematu dla określonej litery.
- cCList
Typ: System.String
Nazwy Adresaci kopii (DW) do list.
- returnAddress
Typ: System.String
Tekst zwrotu dane adresowe dla list.
- senderName
Typ: System.String
Nazwisko osoby, wysyłając list.
- closing
Typ: System.String
Tekst zamknięcia dla list.
- senderCompany
Typ: System.String
Nazwa firmy osoby, tworzenia list.
- senderJobTitle
Typ: System.String
Stanowisko osoby, tworzenia list.
- senderInitials
Typ: System.String
Inicjały osoby, tworzenia list.
- enclosureNumber
Typ: System.Int32
Liczba załączników dla list.
- infoBlock
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- recipientCode
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- recipientGender
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- returnAddressShortForm
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- senderCity
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- senderCode
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- senderGender
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
- senderReference
Typ: System.Object%
Ten argument może być niedostępny, w zależności od języka pomocy technicznej (USAAngielski, na przykład) który wybrałeś lub zainstalowałeś.
Wartość zwracana
Typ: Microsoft.Office.Interop.Word.LetterContent
A LetterContent opierając się na elementach określonej litery.
Uwagi
Parametry opcjonalne
Informacje na temat parametrów opcjonalnych można wyświetlić na Parametry opcjonalne w rozwiązaniach Office.
Przykłady
Następujące kodu przykład pobiera LetterContent przez wywołanie CreateLetterContent metody, a następnie wysyła to LetterContent jako parametr RunLetterWizard metoda.Aby wykorzystać ten przykład, należy uruchomić go z klasy ThisDocument w projekcie na poziomie dokumentu.
Private Sub DocumentRunLetterWizard()
Dim LetterContent As Object = Me.CreateLetterContent( _
DateFormat:=DateTime.Now.ToShortDateString(), IncludeHeaderFooter:=False, _
PageDesign:=String.Empty, LetterStyle:=Word.WdLetterStyle.wdFullBlock, _
Letterhead:=True, LetterheadLocation:=Word.WdLetterheadLocation.wdLetterTop, _
LetterheadSize:=25, RecipientName:="Don Hall", _
RecipientAddress:="100 Main St." + ControlChars.NewLine + "AnyTown, USA", _
Salutation:="Dear Dave,", SalutationType:=Word.WdSalutationType.wdSalutationInformal, _
RecipientReference:=String.Empty, MailingInstructions:=String.Empty, _
AttentionLine:=String.Empty, Subject:="End of year report", CCList:=String.Empty, _
ReturnAddress:=String.Empty, SenderName:=String.Empty, Closing:="Sincerely yours,", _
SenderCompany:=String.Empty, SenderJobTitle:=String.Empty, _
SenderInitials:=String.Empty, EnclosureNumber:=0)
Me.RunLetterWizard(LetterContent, True)
Me.SetLetterContent(LetterContent)
End Sub
private void DocumentRunLetterWizard()
{
object LetterContent = this.CreateLetterContent(
DateTime.Now.ToShortDateString(), false,
String.Empty, Word.WdLetterStyle.wdFullBlock, true,
Word.WdLetterheadLocation.wdLetterTop, 24, "Don Hall",
"100 Main St.\nAnytown, USA",
"Dear Dave,", Word.WdSalutationType.wdSalutationInformal,
String.Empty, String.Empty, String.Empty, "End of year report",
String.Empty, String.Empty, String.Empty, "Sincerely yours,",
String.Empty, String.Empty, String.Empty, 0, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing);
object WizardMode = true;
this.RunLetterWizard(ref LetterContent, ref WizardMode);
this.SetLetterContent(ref LetterContent);
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.