Enable est column width calculation
This commit is contained in:
1 parent
550a6831f3
commit
4f0e72c4e4
11 files changed
+269
-9
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Helper;
|
||||
|
||||
class AppendHelper {
|
||||
|
||||
/**
|
||||
* Instead of seeking and re-writing from position, a better hack might be to write dummy empty data
|
||||
* Enough to take care of any length, then carefully overwrite
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will truncate from specified position
|
||||
* Write data to be inserted and re-append the truncated data
|
||||
*
|
||||
* @param $fp Pointer to file only
|
||||
* @param $pos Position to insert
|
||||
* @param $content Content to insert
|
||||
*/
|
||||
public static function insertToFile($fp, $pos, $content)
|
||||
{
|
||||
fseek($fp, $pos);
|
||||
$trailer = stream_get_contents($fp);
|
||||
ftruncate($fp, $pos);
|
||||
fseek($fp, $pos);
|
||||
fwrite($fp, $content);
|
||||
fwrite($fp, $trailer);
|
||||
return $fp;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user