I am using PHPExcel and found it to be an excellent tool for rendering reports on PHP platform.
I am trying to set a header text on my page - but the issue is that it gets wrapped on on the same column though I am not writing further on that column:
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->insertNewRowBefore(1, 2);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(false);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Amrit Transactions Details for the Month');
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(18);
How can I fix it?
Related
Can anyone guide me how can I achieve this in my web application ? I am using Aspose.PDF Third Party dll in order to achieve this.I want to select text in PDF using Mouse and then want to underline selected text.
Once you have selected the string over PDF file, you may get the selected string and then parse the selected string to Aspose.Pdf for .NET API and then have tried updating its formatting with underlined text. Please take a look over following code snippet to underline searched string.
// Open document
Document pdfDocument = new Document("c:/pdftest/Table_abc.pdf");
// Create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Employee_Name");
// Accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber);
// Get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
// Underline the selected string
textFragment.TextState.Underline = true;
}
// Save resulting PDF document.
pdfDocument.Save("c:/pdftest/TextUnderlined.pdf");
My name is Nayyer and I am developer evangelist at Aspose.
I am using mvcgrid.net for showing my information in tables in a mvc project
How ever it is working properly I want to change
Showing 1 to 10 of 27 entries
of footer and
next and previous
texts of grid but I didn't find an API for that , Can anyone help me with this.
I am configuring my Grid as:
GridDefaults gridDefaults = new GridDefaults()
{
RenderingMode = RenderingMode.Controller,
ViewPath = "~/Views/MVCGrid/_Grid.cshtml",
NoResultsMessage = "Sorry, no results were found",
ItemsPerPage = 25,
MaxItemsPerPage = 200
};
and I update the text of anything I need in the _Grid.cshtml file or any custom View I use instead.
Custom Style
To use a custom style for your table, you can implement the IMVCGridRenderingEngine to create your table. Everything you need to populate your table will be given to you in the RenderingModel object. Once you have the implementation, set the property on your grid definition to use your new rendering engine:
gridDef.DefaultRenderingEngine = typeof(CustomHtmlRenderingEngine);
This same method could also be used to create custom export formats.
You can find it from the link.
http://mvcgrid.net/demo/customstyle
I will Try to add Video Embed to drupal-7 programmatically
with thumb.
This is what I've tried:
$url='https://www.youtube.com/watch?v=8Zq3KCBed5Q';
$file_path = drupal_realpath($url);
$file->uid = 1;
$file->filename = 'dsdss';
$file->uri = $url;
$file->filemime = file_get_mimetype($file_path);
$file->type = 'video';
$file->status = 1;
$file_exists = file_save($file);
$node->field_videoyou[$node->language]['0'] = (array) $file_exists;
How I can do this?
As far as I know, drupal_realpath is converting local drupal path to absolute path and you are passing to it absolute path. Also, you didn't show us where you create that $file object. What is that?
If you check file_save() docs:
https://api.drupal.org/api/drupal/includes!file.inc/function/file_save/7
...you'll see that $file should be "a file object returned by file_load()."
So, I think that you are using drupal_realpath wrong, don't see that you are using file_load() for creating $file object and I don't see that you are copy-ing file to your server.
My suggestion is not to mess with files anyway, but just take player embed code and use it. You can have some text field to your content type where admin can insert video embed code and just shoot that value out on front-end.
Moreever...it will probably happen that embed code is pretty similar for different videos and that only difference is just some video id value so you don't even have to store whole embed code, but just that video id and you can keep rest of embed code in some template file, as static, where you will just insert video id.
I am using CCF (Custom Contact Forms) plugin in which i need to have upload file field at the front end along with other fields. Max upload file size is 2MB that i defined in the plugin.
The issue is that if i try to upload bulky file (e.g 15MB) then form does not display any error and also does not upload files. The only thing happens is that the same form is just refreshed without showing any error even for other fields.
Is this the expected behavior or there is any way to come out of this?
Looking at the code to the plugin, in custom-contact-forms-front.php in function processFileUpload($field) I see:
if ($field->field_max_upload_size > 0 && $_FILES[$field->field_slug]['size'] > ($field->field_max_upload_size * 1000))
$errors[] = basename($_FILES[$field->field_slug]['name']) . __(' is too large of a file. The maximum file size for that field is ', 'custom-contact-forms') . $field->field_max_upload_size . __(' KB.', 'custom-contact-forms');
Which is horrendously cryptic, IMO, but looks like it should be putting an error message in the $errors array. Down below I see
$upload_result = $this->processFileUpload($field, $post_time);
foreach ($upload_result as $err) {
$this->setFormError($field->field_slug, $err);
So it looks like the plugin attempts to create an error message. Would have to dig into some layers to see where it's going wrong.
I'm trying to create an img link manually with php in the header field of a view, in drupal 6. I need to read the value of one of the filters, but can't find the right variable to read. I thought I could print_r($view->filters) but it didn't give me anything, and I eventually found out that isset($view) is false.
Am I looking the wrong way?
The context I'm writing in is the header field of the view, with php code as input format. Do I have to "enable" the $view variable for reading in this context somehow?
OK I found it, it was really easy:
$pa_view = views_get_current_view();
$pa_nr = $pa_view->display['default']->display_options['filters']['field_nummer_value']['value']['value'];