public int Add(int pageId, int pageSectionTypeId) { var page = _context.Pages.SingleOrDefault(x => x.PageId == pageId); var sectionType = _context.PageSectionTypes.SingleOrDefault(x => x.PageSectionTypeId == pageSectionTypeId); var sectionPosition = 1; if (page.PageSections.Any()) { sectionPosition = (page.PageSections.Max(x => x.PageSectionId) + 1); } var newPageSection = new PageSection { PageId = pageId, PageSectionTypeId = pageSectionTypeId, PageSectionBody = sectionType.PageSectionTypeBody, PageSectionOrder = sectionPosition }; _context.PageSections.Add(newPageSection); _context.SaveChanges(); var document = new Document(newPageSection.PageSectionBody); newPageSection.PageSectionBody = Document.ReplaceTokens(newPageSection.PageSectionBody, newPageSection.PageSectionId); _context.SaveChanges(); return(newPageSection.PageSectionId); }
/// <summary> /// 获取该文章的Channel包含路径(供页面存储用) /// </summary> /// <returns>Channel的路径,绝对路径</returns> private string GetChannelPath(PageSection pageSection) { SimpleExIndexXmlElement ele = (SimpleExIndexXmlElement)this.SdsiteElement; switch (pageSection) { case PageSection.MainPage: { return(ele.RelativeUrl.Remove(0, 1).Replace('/', '\\')); } case PageSection.Head: { string str = ele.RelativeUrl.Remove(0, 1).Replace('/', '\\'); str = str.Insert(str.LastIndexOf('.'), "_head"); return(str); } case PageSection.Content: { string str = ele.RelativeUrl.Remove(0, 1).Replace('/', '\\'); str = str.Insert(str.LastIndexOf('.'), "_content"); return(str); } case PageSection.None: default: { Debug.Fail("PageSection is Error!"); return(ele.RelativeUrl.Remove(0, 1).Replace('/', '\\')); } } }
private void RenderFooter(RPLWriter rplWriter) { double columnWidth = this.m_pageContext.ColumnWidth; double columnHeight = this.m_pageContext.ColumnHeight; PageContext pageContext = new PageContext(this.m_pageContext); pageContext.IgnorePageBreaks = true; pageContext.IgnorePageBreaksReason = PageContext.IgnorePageBreakReason.InsideHeaderFooter; pageContext.EvaluatePageHeaderFooter = false; pageContext.Common.Pagination.CurrentColumnWidth = this.m_pageContext.Common.Pagination.UsablePageWidth; pageContext.Common.InHeaderFooter = true; double footerHeight = this.m_sectionPageSettings.FooterHeight; pageContext.Common.Pagination.CurrentColumnHeight = footerHeight; PageSection pageFooter = this.m_reportSection.Page.PageFooter; this.m_footer = new PageHeadFoot(pageFooter, this.m_pageSettings.UsablePageWidth, false); bool flag = false; this.m_footer.CalculateVertical(pageContext, 0.0, footerHeight, null, new List <PageItem>(), ref flag, true); this.m_footer.CalculateHorizontal(pageContext, 0.0, this.m_pageSettings.UsablePageWidth, null, new List <PageItem>(), ref flag, true); this.m_footer.AddToPage(rplWriter, pageContext, 0.0, 0.0, this.m_pageSettings.UsablePageWidth, footerHeight, PageItem.RepeatState.None); pageContext.Common.Pagination.CurrentColumnWidth = columnWidth; pageContext.Common.Pagination.CurrentColumnHeight = columnHeight; pageContext.Common.InHeaderFooter = false; }
internal PageHeadFoot(PageSection source, double width, bool aIsHeader) : base(null) { m_itemPageSizes = new FixedItemSizes(width, source.Height.ToMillimeters()); m_source = source; m_isHeader = aIsHeader; }
private void FinalCheckForHeader(PageSection header, int page, bool lastPage, bool firstSectionOnPage, ref bool renderHeader) { if (((header != null) & renderHeader) && !m_pageContext.AddFirstPageHeaderFooter && page > 1 && firstSectionOnPage && lastPage && !header.PrintOnLastPage) { renderHeader = false; } }
private void InitialCheckForFooter(PageSection footer, int page, int totalPages, bool lastReportSection, ref bool renderFooter) { if (footer == null) { return; } if (m_pageContext.AddFirstPageHeaderFooter) { renderFooter = true; } else if (totalPages > 0) { if (page >= 1 && page < totalPages) { renderFooter = true; } else if (lastReportSection) { if (footer.PrintOnLastPage) { renderFooter = true; } } else if (footer.PrintBetweenSections) { renderFooter = true; } } else { renderFooter = true; } }
private void RenderFooter(RPLWriter rplWriter) { double columnWidth = m_pageContext.ColumnWidth; double columnHeight = m_pageContext.ColumnHeight; PageContext pageContext = new PageContext(m_pageContext); pageContext.IgnorePageBreaks = true; pageContext.IgnorePageBreaksReason = PageContext.IgnorePageBreakReason.InsideHeaderFooter; pageContext.EvaluatePageHeaderFooter = false; pageContext.Common.Pagination.CurrentColumnWidth = m_pageContext.Common.Pagination.UsablePageWidth; pageContext.Common.InHeaderFooter = true; double footerHeight = m_sectionPageSettings.FooterHeight; pageContext.Common.Pagination.CurrentColumnHeight = footerHeight; PageSection pageFooter = m_reportSection.Page.PageFooter; m_footer = new PageHeadFoot(pageFooter, m_pageSettings.UsablePageWidth, aIsHeader: false); bool anyAncestorHasKT = false; m_footer.CalculateVertical(pageContext, 0.0, footerHeight, null, new List <PageItem>(), ref anyAncestorHasKT, hasUnpinnedAncestors: true); m_footer.CalculateHorizontal(pageContext, 0.0, m_pageSettings.UsablePageWidth, null, new List <PageItem>(), ref anyAncestorHasKT, hasUnpinnedAncestors: true); m_footer.AddToPage(rplWriter, pageContext, 0.0, 0.0, m_pageSettings.UsablePageWidth, footerHeight, PageItem.RepeatState.None); pageContext.Common.Pagination.CurrentColumnWidth = columnWidth; pageContext.Common.Pagination.CurrentColumnHeight = columnHeight; pageContext.Common.InHeaderFooter = false; }
public PageLayout GetLayout(IDocument document) { var bodyPart = new PagePart { Name = "Body", Renderer = "Body" }; var mainSection = new PageSection { Name = "Main" }; mainSection.Parts.Add(bodyPart); var twitterPart = new PagePart() { Name = "Twitter", Renderer = "Twitter" }; var sidebarSection = new PageSection { Name = "Sidebar" }; sidebarSection.Parts.Add(twitterPart); var layout = new PageLayout { Name = "BaseDocumentLayout" }; layout.Sections.Add(mainSection); layout.Sections.Add(sidebarSection); return(layout); }
/// <summary> /// 获取当前节点生成的Xhtml代码字符串 /// </summary> public virtual string ToHtml(PageSection pageSection) { switch (pageSection) { case PageSection.MainPage: if (!_isAlreadyToContentHtml) { this.MarkXhtmlElement(pageSection); } return(this._XhtmlElement.DocumentXhtmlElement.InnerXml); case PageSection.Head: if (!_isAlreadyToHeadHtml) { this.MarkXhtmlElement(pageSection); } return(this._HeadXhtmlElement.DocumentXhtmlElement.InnerXml); case PageSection.Content: if (!_isAlreadyToContentHtml) { this.MarkXhtmlElement(pageSection); } return(this._ContentXhtmlElement.DocumentXhtmlElement.InnerXml); case PageSection.None: default: Debug.Fail(pageSection + " cannot used by \"switch\" !"); return(""); } }
public PageSnippet(Snippet pSnippet, int iLevel, PageSection eSection) { this.Snippet = pSnippet; this.Level = iLevel; this.Section = eSection; this.m_iID = s_sSnippetID; s_sSnippetID++; }
private bool IsHeaderUnknown(bool isFirstSection, int page, int totalPages) { PageSection pageHeader = this.m_reportSection.Page.PageHeader; if (isFirstSection && page > 1 && totalPages == 0 && pageHeader != null) { return(!pageHeader.PrintOnLastPage); } return(false); }
public bool HasFooterOnPage(int page, int totalPages) { PageSection pageFooter = m_reportSection.Page.PageFooter; if (pageFooter != null && ((page > 1 && (totalPages == 0 || page < totalPages)) || (pageFooter.PrintOnFirstPage && page == 1 && page != totalPages) || (pageFooter.PrintOnLastPage && page == totalPages))) { return(true); } return(false); }
public void CalculateDelayedHeader(RPLWriter rplWriter, Interactivity interactivity) { PageSection pageHeader = this.m_reportSectionDef.Page.PageHeader; PageContext pageContext = new PageContext(this.m_pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.HeaderFooter); pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Header; this.m_header = new PageHeadFoot(pageHeader, this.m_reportSectionDef.Width, pageContext); this.m_header.CalculateItem(rplWriter, pageContext, true, interactivity, true); this.m_itemsOnPage++; }
internal void CalculateDelayedFooter(RPLWriter rplWriter, Interactivity interactivity) { PageSection pageFooter = m_reportSectionDef.Page.PageFooter; PageContext pageContext = new PageContext(m_pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.HeaderFooter); pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Footer; m_footer = new PageHeadFoot(pageFooter, m_reportSectionDef.Width, pageContext); m_footer.CalculateItem(rplWriter, pageContext, isHeader: false, interactivity, native: true); m_itemsOnPage++; }
public PageVariableData(PageTemplateSection pageTemplateSection, PageSection pageSectionOrNull) { if (pageTemplateSection == null) { throw new ArgumentNullException("pageTemplateSection"); } this.PageTemplateSection = pageTemplateSection; this.PageSection = pageSectionOrNull; }
private void AppendMissingTitle(PageSection rootSection) { foreach (var child in rootSection.Children) { if (string.IsNullOrEmpty(child.Title)) { child.Title = "[Отсутствует текст заголовка]"; } AppendMissingTitle(child); } }
internal PageHeadFoot(PageSection source, ReportSize width, PageContext pageContext) : base(null, createForRepeat: false) { if (pageContext != null) { m_itemPageSizes = pageContext.GetSharedItemSizesElement(width, source.Height, source.ID, isPadded: true); } else { m_itemPageSizes = new PaddItemSizes(width, source.Height, source.ID); } m_source = source; }
public PageHeadFoot(PageSection source, ReportSize width, PageContext pageContext) : base(null, false) { if (pageContext != null) { base.m_itemPageSizes = pageContext.GetSharedItemSizesElement(width, source.Height, source.ID, true); } else { base.m_itemPageSizes = new PaddItemSizes(width, source.Height, source.ID); } this.m_source = source; }
private List <PageSnippet> FindSectionSnippets(PageSection eSection) { List <PageSnippet> lSectionSnippets = new List <PageSnippet>(); foreach (PageSnippet pSnippet in m_lPageSnippets) { if (pSnippet.Section == eSection) { lSectionSnippets.Add(pSnippet); } } return(lSectionSnippets); }
/// <summary> /// Разбирает содержимое страницы, возвращая ее корневую секцию. /// </summary> /// <param name="content">Содержимое страницы.</param> /// <returns>Корневая секция страницы.</returns> public PageSection Parse(string content) { var rootSection = new PageSection(0, 0, 0, string.Empty, 0) { Content = content }; var path = new Stack <PageSection>(); path.Push(rootSection); int level = 0; int position = 0; bool isLast = false; PageSection nextSection; while ((nextSection = FindNextSection(content, position, level, ref isLast)) != null) { var previousSection = path.Peek(); int offsetFromPrevious = nextSection.Position - (previousSection.Position + previousSection.Length); foreach (var section in path) { section.Length += offsetFromPrevious; } var parent = FindParentSection(path, nextSection); foreach (var section in path) { section.Length += nextSection.Length; } if (!isLast) { parent.Children.Add(nextSection); } else { previousSection.Length += nextSection.Length; } path.Push(nextSection); position = nextSection.Position + nextSection.Length; level = nextSection.Level; } return(rootSection); }
internal bool IsHeaderPrintOnLastPage() { PageSection pageHeader = m_reportSectionDef.Page.PageHeader; if (pageHeader == null) { return(false); } if (pageHeader.PrintOnLastPage) { return(true); } return(false); }
/// <summary> /// Returns true if store front and client (parent record) are both active /// </summary> /// <param name="storeFront"></param> /// <returns></returns> public static bool IsActiveBubble(this PageSection pageSection) { if (pageSection == null) { throw new ArgumentNullException("pageSection"); } if (pageSection.PageSectionId == default(int)) { return(false); } return(pageSection.IsActiveDirect() && pageSection.Page.IsActiveBubble() && pageSection.PageTemplateSection.IsActiveDirect() && pageSection.StoreFront.IsActiveBubble()); }
/// <summary> /// Получает родительскую секцию для секции <paramref name="section"/>. /// </summary> /// <param name="path">Текущий путь поиска секций.</param> /// <param name="section">Секция, для которой необходимо найти родительский элемент.</param> /// <returns>Родительская секция; null, если такой секции нет.</returns> private PageSection FindParentSection(Stack <PageSection> path, PageSection section) { while (path.Any()) { var topSection = path.Peek(); if (topSection.Level < section.Level) { return(topSection); } path.Pop(); } return(null); }
/// <summary> /// Получает узел с преамблой к статье. Если преамбулы нет, возвращается null. /// </summary> /// <param name="content">Содержимое страницы.</param> /// <param name="rootSection">Корневая секция</param> /// <param name="hasToc">Есть ли в статье содержание или нет.</param> /// <param name="level">Уровень заголовка</param> /// <returns></returns> private PageSection GetPreamble(string content, PageSection rootSection, int level) { // преамбула есть в том случае, если между корневой секцией и следующей смещение равно нулю if (rootSection.Children.Count == 0 || rootSection.Position == rootSection.Children[0].Position) { return(null); } var len = rootSection.Children[0].Position; var innerContent = content.Substring(0, len); return(new PageSection(0, len, level, String.Empty, 0) { Content = innerContent }); }
private void create_cmd(ref MySqlCmd.MySqlContext udata) { // 遍历页面找到HtmlInputText控件 PageSection <HtmlInputText> page = new PageSection <HtmlInputText>(this.modal_body.Controls); // 遍历所有HtmlInputText控件, 填入数据 string context = "INSERT INTO `USER_FORM` (`"; for (int i = 0; i < page.ControlsContainer.Count; i++) { if (i < page.ControlsContainer.Count - 1) { if (page.ControlsContainer[i].Value != "" || page.ControlsContainer[i].Value != null) { context += page.ControlsContainer[i].Name + "`, `"; } } else { if (page.ControlsContainer[i].Value != "" || page.ControlsContainer[i].Value != null) { context += page.ControlsContainer[i].Name + "`) VALUES ('"; } break; } } for (int i = 0; i < page.ControlsContainer.Count; i++) { if (i < page.ControlsContainer.Count - 1) { if (page.ControlsContainer[i].Value != "" || page.ControlsContainer[i].Value != null) { context += page.ControlsContainer[i].Value + "', '"; } } else { if (page.ControlsContainer[i].Value != "" || page.ControlsContainer[i].Value != null) { context += page.ControlsContainer[i].Value + "');"; } break; } } udata.context = context; }
private void FinalCheckForFooter(PageSection footer, int page, bool lastPage, bool lastSectionOnPage, ref bool renderFooter) { if (!((footer != null) & renderFooter) || m_pageContext.AddFirstPageHeaderFooter) { return; } bool flag = false; if (!lastPage) { if (page == 1) { if (lastSectionOnPage) { if (footer.PrintOnFirstPage) { flag = true; } } else if (footer.PrintBetweenSections) { flag = true; } } else if (lastSectionOnPage) { flag = true; } else if (footer.PrintBetweenSections) { flag = true; } } else if (lastSectionOnPage) { if (footer.PrintOnLastPage) { flag = true; } } else if (footer.PrintBetweenSections) { renderFooter = true; } renderFooter = flag; }
/// <summary> /// 生成頁面的单个子文件到默認目錄。成功时返回一个Bool值为True。 /// 调用时建议判断一下是否保存成功。 /// </summary> /// <param name="section">正在生成的子文件类型,枚举</param> /// <returns>返回保存是否成功,不成功有两种情况,1文件系统导致,2该类型不支持存储成文件</returns> public virtual bool SaveXhtml(ToHtmlHelper htmlhelper, PageSection section) { switch (section) { case PageSection.MainPage: return(ToHtmlHelper.FileSave(this.HtmlFile, this.ToHtml(section))); case PageSection.Head: return(ToHtmlHelper.FileSave(this.HtmlHeadFile, this.ToHtml(section))); case PageSection.Content: return(ToHtmlHelper.FileSave(this.HtmlContentFile, this.ToHtml(section))); case PageSection.None: default: Debug.Fail("PageSection is Error!"); return(ToHtmlHelper.FileSave(this.HtmlFile, this.ToHtml(section))); } }
public Boolean Edit(String ID, String ModifiedBy) { try { _Obj = db.PageSections.FirstOrDefault(pram => pram.Id == new Guid(ID)); if (_Obj != null) { _Obj.ModifiedOn = DateTime.Now; _Obj.ModifiedBy = new Guid(ModifiedBy); db.SaveChanges(); return true; } return false; } catch (Exception) { return false; } }
public static PageSectionVersion MapToPageSectionVersion(this PageSection pageSection) { PageSectionVersion pageRouteVersion = new PageSectionVersion { Id = pageSection.PageSectionVersionId.Value, EnTitle = pageSection.EnTitle, ArTitle = pageSection.ArTitle, EnDescription = pageSection.EnDescription, ArDescription = pageSection.ArDescription, Order = pageSection.Order, IsActive = pageSection.IsActive, Url = pageSection.Url, EnImageAlt = pageSection.EnImageAlt, ArImageAlt = pageSection.ArImageAlt, PageSectionType = pageSection.PageSectionType, PageSectionTypeId = pageSection.PageSectionTypeId, PageRouteVersion = pageSection.PageSectionVersion.PageRouteVersion, PageRouteVersionId = pageSection.PageSectionVersion.PageRouteVersionId }; return(pageRouteVersion); }
/// <summary> /// Register the ConLib control and generate the Tag output for specified section /// </summary> /// <param name="control">The ConLib control</param> /// <param name="pageSection">The page section</param> /// <param name="registeredControls">Already registered controls</param> /// <returns>Generated tag output as string</returns> private static string GenerateControlTag(ConLibControl control, PageSection pageSection, List <RegisteredControl> registeredControls) { string tagName = RegisterControl(control, registeredControls); string controlId = tagName; // if there are multiple instances of same control, generate the control id using number if (control.InstanceId.Contains("$")) { controlId = tagName + "_" + control.InstanceId.Split('$')[1]; } switch (pageSection) { case PageSection.Header: controlId += "_H"; break; case PageSection.LeftSideBar: controlId += "_Left"; break; case PageSection.RightSidebar: controlId += "_Right"; break; case PageSection.Footer: controlId += "_F"; break; } // CHECK IF ANY PARAMETERS SPECIFIED string parameterString = string.Empty; foreach (ConLibControlParam param in control.Params) { if (!string.IsNullOrEmpty(param.CustomValue)) { parameterString += string.Format(" {0}=\"{1}\"", param.Name, param.CustomValue); } } return(string.Format(CONTROL_TAG_PATTERN, tagName, controlId, parameterString)); }
public bool HasFooterOnPage(int page, int totalPages) { PageSection pageFooter = this.m_reportSection.Page.PageFooter; if (pageFooter != null) { if (page > 1 && (totalPages == 0 || page < totalPages)) { goto IL_003b; } if (pageFooter.PrintOnFirstPage && page == 1 && page != totalPages) { goto IL_003b; } if (pageFooter.PrintOnLastPage && page == totalPages) { goto IL_003b; } } return(false); IL_003b: return(true); }
private void LoadAboutUS() { try { PageSectionsRepository _rpoObj = new PageSectionsRepository(); PageSection _PageSectionObjDefault = new PageSection(); _PageSectionObjDefault = _rpoObj.LoadByLanguageIdAndIsDefault(true, "b5c66d73-b2fa-436d-817a-e5332af83934"); lblAboutTitleDefault.Text = _PageSectionObjDefault.SectionTitle; lblAboutContentDefault.Text = _PageSectionObjDefault.SectionContent; //imgAboutDefault.ImageUrl = ConfigurationManager.AppSettings["Pages"].ToString() + _PageSectionObjDefault.ImageFile; //_PageSectionObjDefault = new PageSection(); //_PageSectionObjDefault = _rpoObj.LoadById("8dd20d86-fdec-4c73-aab6-681a450d5057"); //lblAboutTitle1.Text = _PageSectionObjDefault.SectionTitle; //lblAboutContent1.Text = _PageSectionObjDefault.SectionContent; //_PageSectionObjDefault = new PageSection(); //_PageSectionObjDefault = _rpoObj.LoadById("f22f80bd-eb48-4dc7-b7f7-73b37ee1135c"); //lblAboutTitle2.Text = _PageSectionObjDefault.SectionTitle; //lblAboutContent2.Text = _PageSectionObjDefault.SectionContent; } catch (Exception) { } }
//����ҳ�� private PageSectionType CreatPageFooter() { Style style = new Style(); Textbox ctb = new Textbox(); string height = "0.65cm"; string top = "0mm"; ArrayList Items = new ArrayList(); style.FontSize = "9pt"; style.TextAlign = "Left"; ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm"; ctb.Height = "0.63cm"; ctb.Paragraphs = CreateParagraphs(PageFooterLeftText,style.Create()); ctb.Style = style.Create(); ctb.CanGrow = true; ctb.Left = LeftMargin.ToString() + "mm"; TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText"); if (!string.IsNullOrEmpty(this.PageFooterLeftText)) { Items.Add(headerLeftTextbox); height = "1.1cm"; top = "0.6cm"; } style.TextAlign = "Right"; ctb.Style = style.Create(); ctb.Left = ((A4Width) / 2).ToString() + "mm"; ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create()); TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText"); if (!string.IsNullOrEmpty(this.PageFooterRightText)) { Items.Add(headerRightTextbox); height = "1.1cm"; top = "0.6cm"; } style.TextAlign = "Center"; ctb = new Textbox { Top = top, Height = "0.6cm", Left = LeftMargin.ToString() + "mm", Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm", Paragraphs = CreateParagraphs(string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()), //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), Style = style.Create() }; TextboxType headerTextbox = ctb.Create("Page_FooterText"); Items.Add(headerTextbox); ReportItemsType reportItems = new ReportItemsType(); reportItems.Items = Items.ToArray(); PageSection header = new PageSection(); header.ReportItems = reportItems; header.Height = height; header.PrintOnFirstPage = true; header.PrintOnLastPage = true; return header.Create(); }
//����ҳü private PageSectionType CreatPageHeader() { double height = 0.91; double LRHeigth = 0.0; double tableHeaderHeigth = 0.0; ArrayList Items = new ArrayList(); Textbox ctb = new Textbox { Height = "0.9cm", Left = LeftMargin.ToString() + "mm", Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm", Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily="����", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()), CanGrow = true , Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create() }; TextboxType headerTextbox = ctb.Create("Page_HeaderText"); Items.Add(headerTextbox); ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm"; ctb.Height = "0.5cm"; ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText); ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create(); ctb.Top = "0.92cm"; TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText"); if (!string.IsNullOrEmpty(this.PageHeaderLeftText)) { Items.Add(headerLeftTextbox); LRHeigth = 0.5; } ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create(); ctb.Left = ((A4Width) / 2).ToString() + "mm"; ctb.Paragraphs = CreateParagraphs(PageHeaderRightText); TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText"); if (!string.IsNullOrEmpty(this.PageHeaderRightText)) { Items.Add(headerRightTextbox); LRHeigth = 0.5; } ReportItemsType reportItems = new ReportItemsType(); reportItems.Items = Items.ToArray(); PageSection header = new PageSection(); header.ReportItems = reportItems; height = height+tableHeaderHeigth + LRHeigth; header.Height = height.ToString()+"cm"; header.PrintOnFirstPage = true; header.PrintOnLastPage = true; return header.Create(); }
//创建页脚 private PageSectionType CreatPageFooter() { string height = "0.65cm"; string top = "0mm"; var items = new ArrayList(); var style = new Style {FontSize = "9pt", TextAlign = "Left"}; var ctb = new Textbox { Width = ((A4Width - LeftMargin - RightMargin)/2) + "mm", Height = "0.63cm", Paragraphs = CreateParagraphs(PageFooterLeftText, style.Create()), Style = style.Create(), CanGrow = true, Left = LeftMargin + "mm" }; TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText"); if (!string.IsNullOrEmpty(PageFooterLeftText)) { items.Add(headerLeftTextbox); height = "1.1cm"; top = "0.6cm"; } style.TextAlign = "Right"; ctb.Style = style.Create(); ctb.Left = ((A4Width) / 2) + "mm"; ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create()); TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText"); if (!string.IsNullOrEmpty(PageFooterRightText)) { items.Add(headerRightTextbox); height = "1.1cm"; top = "0.6cm"; } style.TextAlign = "Center"; ctb = new Textbox { Top = top, Height = "0.6cm", //Left = LeftMargin + "mm", Width = (A4Width - LeftMargin - RightMargin) + "mm", Paragraphs = CreateParagraphs(string.Format("=" + _pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()), //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), Style = style.Create() }; TextboxType headerTextbox = ctb.Create("Page_FooterText"); items.Add(headerTextbox); var reportItems = new ReportItemsType { Items = items.ToArray() }; var header = new PageSection { ReportItems = reportItems, Height = height, PrintOnFirstPage = true, PrintOnLastPage = true }; return header.Create(); }
//创建页眉 private PageSectionType CreatPageHeader() { var height = 0.91; var lrHeigth = 0.0; const double tableHeaderHeigth = 0.0; var items = new ArrayList(); var ctb = new Textbox { Height = "0.9cm", Left = LeftMargin + "mm", Width = (A4Width - LeftMargin - RightMargin) + "mm", Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily = "宋体", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()), CanGrow = true, Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create() }; TextboxType headerTextbox = ctb.Create("Page_HeaderText"); items.Add(headerTextbox); ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2) + "mm"; ctb.Height = "0.5cm"; ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText); ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create(); ctb.Top = "0.92cm"; TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText"); if (!string.IsNullOrEmpty(PageHeaderLeftText)) { items.Add(headerLeftTextbox); lrHeigth = 0.5; } ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create(); ctb.Left = ((A4Width) / 2) + "mm"; ctb.Paragraphs = CreateParagraphs(PageHeaderRightText); TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText"); if (!string.IsNullOrEmpty(PageHeaderRightText)) { items.Add(headerRightTextbox); lrHeigth = 0.5; } var reportItems = new ReportItemsType {Items = items.ToArray()}; var header = new PageSection {ReportItems = reportItems}; height = height + tableHeaderHeigth + lrHeigth; header.Height = height + "cm"; header.PrintOnFirstPage = true; header.PrintOnLastPage = true; return header.Create(); }
private void LoadAboutUS() { PageSectionsRepository _rpoObj = new PageSectionsRepository(); PageSection _PageSectionObjDefault = new PageSection(); _PageSectionObjDefault = _rpoObj.LoadByLanguageIdPram("097BE02E-A019-4853-AD50-F22EF5F0BF0F"); try { lblAboutTitleDefault.Text = _PageSectionObjDefault.SectionTitle; lblAboutContentDefault.Text = _PageSectionObjDefault.SectionContent; } catch (Exception) { } }
public PageSection LoadById(String ID) { if (ID != null) { _Obj = db.PageSections.FirstOrDefault(pram => pram.Id == new Guid(ID)); return _Obj; } return null; }
public PageSectionsRepository() { db = new DBDataContext(); _Obj = new PageSection(); }
public PageSection LoadByLanguageIdPram(String LanguageId, Boolean ActiveState = true, String SortField = "CreatedOn", String SortType = "ASC") { try { _Obj = db.PageSections.FirstOrDefault(pram => pram.Active == ActiveState && pram.LanguageId == new Guid(LanguageId)); return _Obj; } catch (Exception Ex) { return null; } }