本文整理汇总了C#中Application.CentimetersToPoints方法的典型用法代码示例。如果您正苦于以下问题:C# Application.CentimetersToPoints方法的具体用法?C# Application.CentimetersToPoints怎么用?C# Application.CentimetersToPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.CentimetersToPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportWholeSchedule
public static void ExportWholeSchedule(
ScheduleRepository _repo,
string filename,
bool save,
bool quit)
{
object oMissing = Missing.Value;
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
//Start Word and create a new document.
_Application oWord = new Application { Visible = true };
_Document oDoc = oWord.Documents.Add();
oDoc.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
oDoc.PageSetup.TopMargin = oWord.CentimetersToPoints(1);
oDoc.PageSetup.BottomMargin = oWord.CentimetersToPoints(1);
oDoc.PageSetup.LeftMargin = oWord.CentimetersToPoints(1);
oDoc.PageSetup.RightMargin = oWord.CentimetersToPoints(1);
int pageCounter = 0;
foreach (var faculty in _repo.GetAllFaculties().OrderBy(f => f.SortingOrder))
{
var facultyName = faculty.Name;
for (int dayOfWeek = 1; dayOfWeek < 7; dayOfWeek++)
{
string dow = Constants.Constants.DOWLocal[dayOfWeek];
var schedule = _repo.GetFacultyDOWSchedule(faculty.FacultyId, dayOfWeek);
Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add();
oPara1.Range.Text = "Расписание";
oPara1.Range.Font.Bold = 0;
oPara1.Range.Font.Size = 10;
oPara1.Range.ParagraphFormat.LineSpacingRule =
WdLineSpacing.wdLineSpaceSingle;
oPara1.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
oPara1.SpaceAfter = 0;
oPara1.Range.InsertParagraphAfter();
Range TextBoxRange = oPara1.Range;
oPara1 = oDoc.Content.Paragraphs.Add();
oPara1.Range.Text = "второго семестра 2013 – 2014 учебного года";
oPara1.Range.Font.Bold = 0;
oPara1.Range.Font.Size = 10;
oPara1.Range.ParagraphFormat.LineSpacingRule =
WdLineSpacing.wdLineSpaceSingle;
oPara1.Range.InsertParagraphAfter();
oPara1 = oDoc.Content.Paragraphs.Add();
oPara1.Range.Text = facultyName;
oPara1.Range.Font.Bold = 0;
oPara1.Range.Font.Size = 10;
oPara1.Range.ParagraphFormat.LineSpacingRule =
WdLineSpacing.wdLineSpaceSingle;
oPara1.Range.InsertParagraphAfter();
oPara1 = oDoc.Content.Paragraphs.Add();
oPara1.Range.Font.Size = 14;
oPara1.Range.Text = dow.ToUpper();
oPara1.Range.Font.Bold = 1;
oPara1.Range.ParagraphFormat.LineSpacingRule =
WdLineSpacing.wdLineSpaceSingle;
oPara1.Range.InsertParagraphAfter();
Shape cornerStamp = oDoc.Shapes.AddTextbox(
Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal,
oWord.CentimetersToPoints(22f),
oWord.CentimetersToPoints(0.5f),
200, 50,
TextBoxRange);
cornerStamp.TextFrame.TextRange.ParagraphFormat.LineSpacingRule =
WdLineSpacing.wdLineSpaceSingle;
if (dow == "Понедельник")
{
cornerStamp.TextFrame.TextRange.Text = @"«УТВЕРЖДАЮ»" +
Environment.NewLine + "Проректор по учебной работе" +
Environment.NewLine + "______________ А.В.Синицкий";
cornerStamp.TextFrame.TextRange.Font.Size = 10;
cornerStamp.TextFrame.TextRange.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight;
}
cornerStamp.TextFrame.WordWrap = 1;
cornerStamp.TextFrame.TextRange.ParagraphFormat.SpaceAfter = 0;
cornerStamp.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
var timeList = new List<string>();
foreach (var group in schedule)
{
foreach (var time in group.Value.Keys)
{
if (!timeList.Contains(time))
{
timeList.Add(time);
}
}
}
//.........这里部分代码省略.........