Tuesday, 15 March 2011

excel - return binary code instead of string in response php -



excel - return binary code instead of string in response php -

i want read excel file php , send content client. want changing content type , other html headers forcefulness browser download file instead of showing content. ok , user can download file when tries open contents not displayed in right format , shape. thing comes mind should not send response in unicode string , have in binary format excel can know it. current code :

$filename = $_get['file']; $ext = $_get['type']; $filename .= '.' . $ext; $path = "../generatedreports/" . $filename; header('content-type: application/vnd.ms-excel;'); header('content-disposition: attachment; filename=' . $filename); header("pragma: public"); header("expires: 0"); header("cache-control: must-revalidate, post-check=0, pre-check=0"); header("cache-control: public", false); header("content-description: file transfer"); header("accept-ranges: bytes"); header("content-transfer-encoding: binary"); header("content-length: " . filesize($path)); $size = filesize($path); $f = fopen($path, 'r'); $content = fread($f, $size); echo $content;

any solution?

please seek below code,

echo unicode2utf8(hexdec("00ce")); // result: Î // or function recognize u+ in front end of string, , skip show character function unicodecodepointtochar($str) { if (substr($str,0,2) != "u+") homecoming $str; $str = substr($str,2); // skip u+ homecoming unicode_to_utf8(array(hexdec($str))); } echo unicodecodepointtochar("u+00ce"); // result: Î

php excel binary

How to find resolution of video/image file in Android -



How to find resolution of video/image file in Android -

i want know resolution(height, width) of media file (video/image) in android.

i have file path , can stored in internal or external storage.

i came across apis mediastore, media etc. don't know how utilize them.

can tell me best efficient way retrieve meta info to the lowest degree overhead?

found way:

for video

mediametadataretriever mdr = new mediametadataretriever(); mdr.setdatasource("file_path"); int height = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_height)); int width = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_width));

for image

bitmap bitmap = bitmapfactory.decodefile("file_path"); bitmap.getheight(); bitmap.getwidth();

android

How to set Winforms Devexpress GridView Width 100 Percentage -



How to set Winforms Devexpress GridView Width 100 Percentage -

i have designed windows application. in forms contains gridview both more columns , less columns. want best fit columns , width of gridview 100 percentage.

try following:

mygridview.bestfitcolumns();

gridview devexpress

asp.net - Why Jquery datepicker popup doesn't appear next to the textbox to which it's associated in IE? -



asp.net - Why Jquery datepicker popup doesn't appear next to the textbox to which it's associated in IE? -

i have several textboxes utilize calendar purpose.

function setupdatepicker() { var $alldatepickers = $('.datepicker'); $.each($alldatepickers, function () { $(this).datepicker(); }); });

ff , chrome work fine, i.e. calendar appear under textbox clicked.

but ie, no matter textbox located, calendar appear next first textbox.

any thought why?

jquery asp.net

regex - Sequence in regular expression -



regex - Sequence in regular expression -

how can write regular look meets next requirements: 1) must 1 sequence 7 digits 2) edd or final word somewhere

this should trick :

#[0-9]{7}(edd|final)?# //edd or final optional

or

#[0-9]{7}(edd|final)+# //if edd or final must there

regex

Wordpress if post or blog category statement -



Wordpress if post or blog category statement -

got little problem here on wordpress.

i trying utilize php check whether page on category page or post page if isn't on either else nothing.

the code have is:

<?php if( (!is_category($category)) || (!is_single($post)) ) { ?> something... <?php } ?>

when seek without or category bit works fine. when bring together them code stops working.

i think you're trying test if it's not category and not post. alter status accordingly:

if( (!is_category($category)) && (!is_single($post)) ) {

wordpress post category

c# - Modify file embedded in Class Library then Save file -



c# - Modify file embedded in Class Library then Save file -

i've been researching couple weeks , having hard time figuring out solution, hoping gain insight posting general question here.

i have class library (in case .xll) have embedded resource (a .xlsm). may or may not know, .xlls associated excel when opens .xll loaded instance of excel. in scenario when .xll loaded excel .xll loads re-create of embedded .xlsm. far good. allows me send out that, intents , purposes, appears unusual excel file end users @ workplace.

the problem comes in when user wants able save changes have made excel sheet. if save desktop (using excels built in save function) saved .xlsm. when .xlsm opened 1 time again .xll no longer loaded , .net features included in .xlsm not function.

a couple questions arise @ point. firstly, why not register .xll system? because if registered .xll every time opens excel .xll open, means embedded .xlsm open (remember, that's .xll on start up.) users tend find annoying... :-).

nextly, why not send both files? answer: much disruption end user (just bear me on this). love or hate it, want 1 file open , modify. them .xll version of .xlsm, , prefer retained perception makes explaining myself much easier.

lastly, why not distribute .xll grouping whole , release .xlsms against that? answer: these .xlls sent whole bunch of random places can't command user have on machine, prefer maintain things self contained.

there 2 basic solutions come mind.

option one figure out how recompile .xll on fly .xlsm (probably via instance of .xll), , save .xll place of users choosing. require me create own save method since excel won't help , include me needing intercept effort user makes @ saving can redirect them own save method. problem can't figure out how create .xll recompile itself, since i'll sending .xll out machines don't have sdk on them. , on top of that, forcing user utilize own save method unwelcome disruption (at to the lowest degree in opinion...)

option two create assembly works executable. contain .xlsm .xll , executable load excel , apply .xll it. long executable doesn't need admin privileges, think i'll fine sending them out in place of regular old file (most people around here never see extension anyway, right icon, people can't tell difference). problem can't figure out how link .xlsm assembly without using resource file , turning .xlsm bytecode. puts @ square one.

in essence, alternative 1 requires me figure out how compile on foreign machine , alternative 2 requires me figure how contain whole .xlsm can modify , place was...or @ to the lowest degree putting somewhere executable can find 1 time again easily.

anyway, if made far have eternal gratitude. i'm stuck trying figure out next , hoping can point me in right direction.

thanks in advance.

c# .net excel-dna