עבודה עםפונטים

גופן הוא קבוצה של דמויות עם גודל מסוים, צבע ועיצוב. Aspose.Words מאפשר לך לעבוד עם גופנים באמצעות Fonts המונחים: Font מעמד.

המונחים:

פורמט הגופן הנוכחי מיוצג על ידי Font החפץ חזר Font רכוש. The The The Font הכיתה מכילה מגוון רחב של תכונות גופניות, העתקת אלה הזמינים ב Microsoft Word.

הדוגמה הבאה של הקוד מראה כיצד להגדיר פורמט גופני:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Set font formatting properties
Font font = builder.Font;
font.Bold = true;
font.Color = System.Drawing.Color.DarkBlue;
font.Italic = true;
font.Name = "Arial";
font.Size = 24;
font.Spacing = 5;
font.Underline = Underline.Double;
// Output formatted text
builder.Writeln("I'm a very nice formatted string.");
dataDir = dataDir + "DocumentBuilderSetFontFormatting_out.doc";
doc.Save(dataDir);

תכונות מילוי זמינים גם עבור גופנים כדי להגדיר פורמט טקסט מלא. זה מאפשר לשנות, למשל, את הצבע הקדמי או את השקיפות של הטקסט למלא.

עקבו אחרי Font Line Spacing

קו פונט ספאק הוא המרחק האנכי בין קווי הבסיס של שני קווים רצופים של טקסט. אז קו ספאק כולל את החלל הריק בין קווים יחד עם גובה הדמות עצמה.

The The The LineSpacing הנכס הוצג בפני Font שיעור להשיג ערך זה, כפי שמוצג בדוגמה להלן:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
// Initialize document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.Name = "Calibri";
builder.Writeln("qText");
// Obtain line spacing.
Font font = builder.Document.FirstSection.Body.FirstParagraph.Runs[0].Font;
Console.WriteLine($"lineSpacing = {font.LineSpacing}");

תגית: Mark

כמה שפות מזרח אסיה משתמשות בסימן דגש מיוחד כדי לציין דגש. The The The Font הכיתה מספקת EmphasisMark לרכוש או להגדיר EmphasisMark ערכי enumeration יש ליישם בעת עיצוב.

דוגמה לקוד הבא מראה כיצד להגדיר את EphasisMark רכוש:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
builder.Font.EmphasisMark = EmphasisMark.UnderSolidCircle;
builder.Write("Emphasis text");
builder.Writeln();
builder.Font.ClearFormatting();
builder.Write("Simple text");
document.Save(dataDir + "FontEmphasisMark_out.doc");