在闪亮的应用中将日期范围设置为pdf

时间:2018-07-03 09:27:55

标签: r pdf datatable shiny downloading

我有一个类似于以下内容的应用:enter image description here

我想在该时间段内将数据表下载为pdf。但是,当我这样做时,仅表导出。 enter image description here

这是主要的R代码:

library(shiny)
  jscode <- "shinyjs.closeWindow = function() { window.close(); }"


 shinyUI(fluidPage(   




  tags$head(
tags$style(HTML("
                @import url('//fonts.googleapis.com/css?family=Anton');

                h2 {
                font-family: 'Anton';
                font-weight: 600;
                line-height: 0.7;
                color: #483D8B;
                }

                "))
),


titlePanel("ZESTAWIENIE 1 v 2"),


sidebarLayout(

  sidebarPanel( tags$head(
    tags$style(type="text/css", ".well { width: 150px; }"),
  tags$style(type="text/css", ".col-sm-4 { width: 170px;}"),
# tags$style(type="text/css", "#close {font-size: 12px; background-color:  #e6e6e6; }") ,
 tags$style(type="text/css", "#get_data { font-size: 12px; background-color:  #e6e6e6;}") ,
  tags$style(type="text/css", "#last_month { font-size: 12px;background-color:  #e6e6e6; }") ,
  tags$style(type="text/css", ".control-label { line-height: 2 ; font-size: 12px;   }") ,
 tags$style(type="text/css", "#text { width: 390px ; font-size: 11px } "),
 tags$style(type="text/css", "#DataTables_Table_0 td[text*='SAL']{ background:#DCDCDC; }") 


     ),

           #  actionButton("close", "Zamknij raport" ,width = '100%' ),
             actionButton("get_data", "Generuj report" ,width =  '100%' ),
             actionButton("last_month", "Ostatni miesiÄ…c", width = '100%' ),
             dateInput('start_date', "Data poczÄ…tkowa", min = '2017-11-01', value= format(Sys.Date()-1, "%Y-%m-01")),
             dateInput('end_date', "Data końcowa", min = '2017-11-01' ,value=   format(Sys.Date()-1, "%Y-%m-%d"))







),


 mainPanel(tags$head(
  tags$style(type="text/css", ".col-sm-8 { width: 89%; }")
 ),


  div(
    verbatimTextOutput("text"), DT::dataTableOutput("results"), style = "font-size:80%" ),



tabsetPanel(
  tabPanel(
           HTML('<footer>
               <h6> kontakt: kk </h6>
                </footer>')

  ))





) 



)





 ))

我把verbatimTextOutput(“ text”)放到哪里,它负责显示日期范围,以便在下载后以pdf格式显示该日期?

1 个答案:

答案 0 :(得分:1)

您可以使用class DisplayImage : public QGraphicsView{ Q_OBJECT public: DisplayImage(QWidget *parent=0); void displayImg(const QImage &image); private: QGraphicsScene *scene; QPixmap pixmap; QGraphicsPixmapItem *pixmapItem; protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); };

DisplayImage::DisplayImage(QWidget* parent) : QGraphicsView(parent){
scene = new QGraphicsScene(this);
pixmapItem=new QGraphicsPixmapItem(pixmap);
scene->addItem(pixmapItem);
this->setScene(scene);
}
void DisplayImage::displayImg(const QImage &image){
pixmap=QPixmap::fromImage(image);
pixmapItem->setPixmap(pixmap);
this->setSceneRect(0,0,image.width(),image.height());
this->fitInView(pixmapItem, Qt::KeepAspectRatio);
this->centerOn(pixmapItem);
}
相关问题