public void UpdateOutput(bool quickLoad) { LocalSchedule = BusinessObjects.Instance.ScheduleManager.GetLocalSchedule(); Controller.Instance.DetailedGridDigitalLegend.Image = Controller.Instance.DetailedGridDigitalLegend.Enabled && !LocalSchedule.ViewSettings.DetailedGridViewSettings.DigitalLegend.Enabled ? Resources.DigitalDisabled : Resources.Digital; Controller.Instance.Supertip.SetSuperTooltip(Controller.Instance.DetailedGridDigitalLegend, new SuperTooltipInfo("Digital Products", "", Controller.Instance.DetailedGridDigitalLegend.Enabled && LocalSchedule.ViewSettings.DetailedGridViewSettings.DigitalLegend.Enabled ? "Digital Products are Enabled for this slide" : "Digital Products are Disabled for this slide" , null, null, eTooltipColor.Gray)); InitThemeSelector(); if (!quickLoad) { xtraTabControlPublications.SuspendLayout(); Application.DoEvents(); xtraTabControlPublications.SelectedPageChanged -= xtraTabControlPublications_SelectedPageChanged; xtraTabControlPublications.TabPages.Clear(); _tabPages.RemoveAll(x => !LocalSchedule.PrintProducts.Select(y => y.UniqueID).Contains(x.PrintProduct.UniqueID)); foreach (var publication in LocalSchedule.PrintProducts) { if (!string.IsNullOrEmpty(publication.Name)) { var publicationTab = _tabPages.FirstOrDefault(x => x.PrintProduct.UniqueID.Equals(publication.UniqueID)); if (publicationTab == null) { publicationTab = new PublicationDetailedGridControl(); _tabPages.Add(publicationTab); Application.DoEvents(); } publicationTab.PrintProduct = publication; publicationTab.PageEnabled = publication.Inserts.Count > 0; publicationTab.LoadPublication(); Application.DoEvents(); } } _tabPages.Sort((x, y) => x.PrintProduct.Index.CompareTo(y.PrintProduct.Index)); xtraTabControlPublications.TabPages.AddRange(_tabPages.ToArray()); LoadView(); AllowToSave = false; SetColumnsState(); UpdateSlideBullets(); AllowToSave = true; Application.DoEvents(); xtraTabControlPublications.SelectedPageChanged += xtraTabControlPublications_SelectedPageChanged; ; xtraTabControlPublications.ResumeLayout(); } else { foreach (var publication in LocalSchedule.PrintProducts) { var publicationTab = _tabPages.FirstOrDefault(x => x.PrintProduct.UniqueID.Equals(publication.UniqueID)); if (publicationTab == null) continue; publicationTab.PrintProduct = publication; Application.DoEvents(); } } SettingsNotSaved = false; }
public void PrepareDetailedGridGridBasedPdf(string targetFileName, PublicationDetailedGridControl[] outputControls) { var sourceFileName = Path.GetTempFileName(); PreparePresentation(sourceFileName, presentation => AppendDetailedGridGridBased(outputControls, presentation)); BuildPdf(sourceFileName, targetFileName); }
public void AppendDetailedGridGridBased(PublicationDetailedGridControl[] outputControls, Presentation destinationPresentation = null) { try { var thread = new Thread(delegate() { foreach (var outputControl in outputControls) { MessageFilter.Register(); var slidesCount = outputControl.OutputReplacementsLists.Count; var rowsCount = slidesCount > 0 ? outputControl.Grid[0].GetLength(0) : 0; for (int k = 0; k < slidesCount; k++) { var presentationTemplatePath = MasterWizardManager.Instance.SelectedWizard.GetDetailedGridFile( Controller.Instance.Grids.DetailedGrid.SelectedColumnsCount, rowsCount , Controller.Instance.Grids.DetailedGrid.ShowCommentsHeader); var currentSlideRowsCount = outputControl.Grid[k].GetLength(0); if (!File.Exists(presentationTemplatePath)) continue; var presentation = PowerPointObject.Presentations.Open(FileName: presentationTemplatePath, WithWindow: MsoTriState.msoFalse); bool hideAdSpecsOnSlide = ((k + 1) < slidesCount && outputControl.ShowAdSpecsOnlyOnLastSlide) || outputControl.DoNotShowAdSpecs; foreach (Slide slide in presentation.Slides) { foreach (Shape shape in slide.Shapes) { for (int i = 1; i <= shape.Tags.Count; i++) { switch (shape.Tags.Name(i)) { case "PLOGO": if (!string.IsNullOrEmpty(outputControl.LogoFile)) slide.Shapes.AddPicture(FileName: outputControl.LogoFile, LinkToFile: MsoTriState.msoFalse, SaveWithDocument: MsoTriState.msoCTrue, Left: shape.Left, Top: shape.Top, Width: shape.Width, Height: shape.Height); shape.Visible = MsoTriState.msoFalse; break; case "HEADER": shape.TextFrame.TextRange.Text = outputControl.Header; break; case "SIGLINE": if (!outputControl.ShowSignatureLine || hideAdSpecsOnSlide) shape.Visible = MsoTriState.msoFalse; break; case "SIGAPPROVAL": if (!outputControl.ShowSignatureLine || hideAdSpecsOnSlide) shape.Visible = MsoTriState.msoFalse; break; } } if (shape.HasTable != MsoTriState.msoTrue) continue; var table = shape.Table; var tableRowsCount = table.Rows.Count; var tableColumnsCount = table.Columns.Count; for (var i = 1; i <= tableRowsCount; i++) { for (var j = 1; j <= tableColumnsCount; j++) { var tableShape = table.Cell(i, j).Shape; if (tableShape.HasTextFrame != MsoTriState.msoTrue) continue; var cellKey = tableShape.TextFrame.TextRange.Text.Trim(); if (!outputControl.OutputReplacementsLists[k].Keys.Contains(cellKey)) continue; var cellText = outputControl.OutputReplacementsLists[k][cellKey]; if (!cellText.Equals("Merge")) { tableShape.TextFrame.TextRange.Text = cellText; outputControl.OutputReplacementsLists[k].Remove(cellKey); } else { tableShape.TextFrame.TextRange.Text = String.Empty; var nextColumnIndex = j - 1; if (nextColumnIndex >= tableColumnsCount) continue; table.Cell(i, j).Merge(table.Cell(i, nextColumnIndex)); table.Cell(i, j).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = PpParagraphAlignment.ppAlignLeft; } } } var deletedRows = 0; var dataStart = 4 + currentSlideRowsCount * (Controller.Instance.Grids.DetailedGrid.ShowCommentsHeader ? 2 : 1); var dataEnd = tableRowsCount - 1; for (var i = dataStart; i <= dataEnd; i++) { table.Rows[i - deletedRows].Delete(); deletedRows++; } tableRowsCount = table.Rows.Count; deletedRows = 0; for (var i = 1; i <= tableRowsCount; i++) { var tableShape = table.Cell(i - deletedRows, 1).Shape; if (tableShape.HasTextFrame != MsoTriState.msoTrue) continue; var cellText = tableShape.TextFrame.TextRange.Text.Trim(); if (!cellText.Equals("MergeComment")) continue; table.Rows[i - deletedRows].Delete(); deletedRows++; } } } var selectedTheme = outputControl.SelectedTheme; if (selectedTheme != null) presentation.ApplyTheme(selectedTheme.GetThemePath()); AppendSlide(presentation, -1, destinationPresentation); presentation.Close(); } } }); thread.Start(); while (thread.IsAlive) Application.DoEvents(); } catch { } finally { MessageFilter.Revoke(); } }
public void PrepareDetailedGridGridBasedEmail(string fileName, PublicationDetailedGridControl[] outputControls) { PreparePresentation(fileName, presentation => AppendDetailedGridGridBased(outputControls, presentation)); }