asp.net - Set splitlate=false on gridview itextsharp -


here layout of page exporting:

-------------------------------  ' text text text               '  '                              '  ' gridview                     '  '                              '  ' text text text               '  --------------------------------

here table after rendering html

<table cellspacing="0" id="mytest_gvmain" style="width:100%;border-collapse:collapse;">    <tbody>      <tr>        <th scope="col">item</th>        <th scope="col">description</th>        <th scope="col">quantity</th>        <th scope="col">unit</th>        <th scope="col">rate</th>      </tr>      <tr>      </tr>    </tbody>  </table>

as see gridview in middle of page. because gridview can of size expanding different pages, set splitlate = false, row stays together. of text in last row on page 1 , of on first row of page 2. please have @ image some data on last row of page 5 , on first row of page 6 . data on last row of page 5 , on first row of page 6. have read documents suggesting document.add(table) add table end of document. there way set splitlate on gridview itself?

based on chris suggestion, have updated code use xmlworker based on link cannot css work in itextsharp (5.4.3) when making pdf.

 using input new memorystream(bytes, false)      dim ms new memorystream()      dim document new itextsharp.text.document(itextsharp.text.pagesize.letter, 36, 36, 36, 36)     dim writer pdfwriter = pdfwriter.getinstance(document, ms)      writer.closestream = false     document.open()      dim htmlcontext htmlpipelinecontext = new htmlpipelinecontext(nothing)     htmlcontext.setacceptunknown(true)     htmlcontext.settagfactory(tags.gethtmltagprocessorfactory())     dim cssresolver icssresolver = xmlworkerhelper.getinstance().getdefaultcssresolver(false)     cssresolver.addcssfile(httpcontext.current.server.mappath("/assets/css/pdf.css"), true)      dim pipeline new cssresolverpipeline(cssresolver, new htmlpipeline(htmlcontext, new pdfwriterpipeline(document, writer)))     dim pdfworker new xmlworker(pipeline, true)     dim p new xmlparser(true, pdfworker, new system.text.utf8encoding)      try          'p.addlistener(pdfworker)         'p.parse(input, encoding.utf8)          xmlworkerhelper.getinstance().parsexhtml(writer, document, input, new filestream(httpcontext.current.server.mappath("~/assets/css/pdf.css"), filemode.open, fileaccess.read))     catch              pdfworker.close()      end try      document.close()     ms.position = 0      response.buffer = true     response.clear()     response.contenttype = "application/pdf"     response.addheader("content-disposition", "attachment; filename=preview.pdf")     response.binarywrite(ms.getbuffer())     response.flush() end using 

any appreciated.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -