locked
Add A Page Break Before the Heading RRS feed

  • Question

  • User1402230106 posted

    i am trying to use inline HTML inside of a SQL stored proc to add in a page break. My html h tags work and my div align works. But the div style that I am trying to add in to add the page break is not working. I am wanting to always have a page break **before** the text Detailed List. 

    SELECT
    od.fID,
    fl.dr,
    od.ID AS odID,
    sd.Code AS sdc,
    sd.sd,
    emp.ID AS eID,
    emp.Name AS en,
    CONCAT (
    '<div style="page-break-before:always">&nbsp;</div>',
    '<div align="center"><h1>Detailed List</h1></div> <br> <br> <br>',
    '<h3>' , emp.Name ,'<h3/> ',
    '<h4>', emp.Address1, '<br>',
    emp.Address2,
    CASE WHEN emp.Address2 = '' THEN NULL ELSE '<br>' END,
    emp.City, ', ', emp.State, ' ', emp.ZIP,
    '<h4/>'
    ) AS addressInfo,
    CONCAT ('<br> <h3> Store # ', st.Code, '<h3/>') AS StoreNumber,
    prod.Code AS pID,
    prod.Name AS pn,
    oi.Quantity,
    emp.Address1,
    emp.Address2,
    emp.City,
    emp.State,
    emp.ZIP,
    emp.Phone
    FROM
    [di].dbo.oi
    INNER JOIN [di].dbo.od ON oi.OrderID = od.ID AND oi.fID = od.fID
    INNER JOIN [di].dbo.fl ON od.fID = fl.ID
    INNER JOIN [di].dbo.emp ON od.eID = emp.ID
    INNER JOIN [di].dbo.st ON od.sID = st.ID
    INNER JOIN [di].dbo.prod ON oi.pID = prod.ID
    INNER JOIN [di].dbo.sd ON od.sdID = sd.ID

    Thursday, May 14, 2020 2:34 PM

All replies

  • User475983607 posted

    Page breaks do not exist in HTML.

    Thursday, May 14, 2020 2:51 PM
  • User1402230106 posted

    Is there a way to have each Detailed List span the entire page then?

    Maybe a div setting to span:page or something?

    Thursday, May 14, 2020 2:56 PM
  • User475983607 posted

    Is there a way to have each Detailed List span the entire page then?

    When have you ever viewed a page break on a web site? 

    Do you mean a line break?

    Thursday, May 14, 2020 3:07 PM
  • User1402230106 posted

    I want each Detailed List to appear on it's own pdf page.

    Thursday, May 14, 2020 4:36 PM
  • User475983607 posted

    I want each Detailed List to appear on it's own pdf page.

    Then why are you asking about HTML when you are building a PDF? 

    Use a PDF library.  You'll need to read the documentation.

    Thursday, May 14, 2020 4:53 PM
  • User-2054057000 posted

    It seems you are trying to build pdf file from the code. But your code does not have that logic. You have to explain to us all the things in details.

    Tuesday, June 2, 2020 3:25 PM