{"id":31,"date":"2020-06-02T16:33:24","date_gmt":"2020-06-02T16:33:24","guid":{"rendered":"http:\/\/bahadirmeric.net\/bahadir\/?p=31"},"modified":"2020-06-02T16:33:24","modified_gmt":"2020-06-02T16:33:24","slug":"excelle-kayit-edelim","status":"publish","type":"post","link":"http:\/\/bahadirmeric.net\/bahadir\/2020\/06\/02\/excelle-kayit-edelim\/","title":{"rendered":"Excell\u2019e kay\u0131t edelim"},"content":{"rendered":"\n<p>Web de yapt\u0131\u011f\u0131m\u0131z sitelerde bazen Excell belgesi yada PDF belgesi olu\u015fturma gereksinimi duyar\u0131z. \u0130nternet \u00fczerinden biraz ara\u015ft\u0131rma yapt\u0131\u011f\u0131n\u0131zda bununla ilgili olarak bir \u00e7ok kod bulabilirsiniz ama bunlar\u0131n baz\u0131lar\u0131 \u00e7al\u0131\u015f\u0131rken baz\u0131lar\u0131da projenizde \u00e7al\u0131\u015fmayacakt\u0131r. \u015eimdi ben sizlere benim s\u0131kl\u0131kla kulland\u0131\u011f\u0131m vede \u00e7al\u0131\u015fan kodu sizlerle payla\u015f\u0131yor olaca\u011f\u0131m. Ayr\u0131ca birde bilmelisiniz ki iki t\u00fcrde Excell belgesi olu\u015fturabilirsiniz. Biri g\u00f6sterdi\u011finiz bir grid\u2019 den direkt olarak dosyan\u0131z\u0131 kar\u015f\u0131 tarafa aktarmay\u0131 sa\u011flamak bir di\u011feri dosyan\u0131z\u0131 bir alanda yada yerde olu\u015fturup dosyaya eri\u015fim yolunu payla\u015f\u0131p siteniz \u00fczerinden indirilmesini sa\u011flamak. T\u00fcm bunlar d\u0131\u015f\u0131nda bir yol daha var asl\u0131nda.Oda e\u011fer bir Intranet uygulamas\u0131 yaz\u0131yorsan\u0131z yada olu\u015fturuyorsan\u0131z gerekli izinlemeleri ayarlay\u0131p dosyan\u0131n direkt d\u00f6k\u00fcm\u00fc isteyen ki\u015finin belgelerim klas\u00f6r\u00fc i\u00e7ine aktar\u0131lmas\u0131n\u0131 sa\u011flamak. Bu y\u00f6ntem \u00f6zel izinlemeler gerekt\u011finden malesefki Internet ortam\u0131nda uygulanabilecek bir y\u00f6ntem de\u011fildir. Biz bunlardan en basitini ve \u00e7al\u0131\u015fan\u0131n\u0131 kullanaca\u011f\u0131z. Yani dosya ne bizim server\u2019\u0131m\u0131zda olu\u015facak nede ki\u015finin bilgisayar\u0131nda olu\u015fturaca\u011f\u0131z. Web sitemiz i\u00e7ine bir grid eleman\u0131 ekleyip i\u00e7ini doldurup buradan olu\u015fturulmas\u0131n\u0131 sa\u011flayaca\u011f\u0131z.<\/p>\n\n\n\n<p>\u015eimdi projenize bir grid sayfas\u0131 ekledi\u011finizi d\u00fc\u015f\u00fcn\u00fcyor, sonras\u0131nda da gerekli y\u00f6ntemler ile bu grid\u2019 di doldurdu\u011funuzu kabul ediyorum. \u0130\u015fte size \u201cExcell\u201d butonuna bast\u0131\u011f\u0131n\u0131z zaman yazman\u0131z gereken kod;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nstring attachment = &quot;attachment; filename=_PersonelListesi.xls&quot;;\nResponse.ClearContent();\nResponse.AddHeader(&quot;content-disposition&quot;, attachment);\nResponse.ContentType = &quot;application\/ms-excel&quot;;\nStringWriter sw = new StringWriter();\nHtmlTextWriter htw = new HtmlTextWriter(sw);\nGridView1.RenderControl(htw);\nResponse.Write(&quot;&lt;meta http-equiv=Content-Type content=\\&quot;text\/html; charset=utf-8\\&gt;&quot;);\nResponse.Write(sw.ToString());\nResponse.End();\n<\/pre><\/div>\n\n\n<p>Birde bu kod var buda ayn\u0131 i\u015flemi yap\u0131yor se\u00e7im sizin hangisini kullanmak isterseniz;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nstring attachment = &quot;attachment; filename=&quot; + fileName;\nResponse.ClearContent();\nResponse.AddHeader(&quot;content-disposition&quot;, attachment);\nResponse.ContentType = &quot;application\/ms-excel&quot;;\nStringWriter sw = new StringWriter();\nHtmlTextWriter htw = new HtmlTextWriter(sw);\ngrdWProgress.RenderControl(htw);\nResponse.Write(sw.ToString());\nResponse.End();\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Web de yapt\u0131\u011f\u0131m\u0131z sitelerde bazen Excell belgesi yada PDF belgesi olu\u015fturma gereksinimi duyar\u0131z. \u0130nternet \u00fczerinden biraz ara\u015ft\u0131rma yapt\u0131\u011f\u0131n\u0131zda bununla ilgili olarak bir \u00e7ok kod bulabilirsiniz ama bunlar\u0131n baz\u0131lar\u0131 \u00e7al\u0131\u015f\u0131rken baz\u0131lar\u0131da projenizde \u00e7al\u0131\u015fmayacakt\u0131r. \u015eimdi ben sizlere benim s\u0131kl\u0131kla kulland\u0131\u011f\u0131m vede \u00e7al\u0131\u015fan kodu sizlerle payla\u015f\u0131yor olaca\u011f\u0131m. Ayr\u0131ca birde bilmelisiniz ki iki t\u00fcrde&#8230; <a class=\"continue-reading-link\" href=\"http:\/\/bahadirmeric.net\/bahadir\/2020\/06\/02\/excelle-kayit-edelim\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":16,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[4,6],"class_list":["post-31","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c","tag-c","tag-visual-studio"],"_links":{"self":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":1,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":32,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/31\/revisions\/32"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/media\/16"}],"wp:attachment":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}