Nope, sorry.
↧
New Post: Adding OLEObjects to the worksheet
↧
New Post: How to bold specific text inside a cell and delete some html tags after bolding
Hi,
Can I ask how can i bold a specific text inside a cell? i know that it can be accomplish by
thanks
Can I ask how can i bold a specific text inside a cell? i know that it can be accomplish by
var workbook = new XLWorkbook();
var worksheet = workbook.Worksheets.Add("Sample Sheet");
worksheet.Cell("A1").Value = "<b>test</b>" + System.Environment.NewLine + "test1";
worksheet.Cell("A1").RichText.Substring(3, 4).SetBold(true);
as what you can see my cell value contains html tags and i can set "test" as bold using substring as per the documentation states. my problem is i needed to delete the <b> tags right after i bold the "test" string. i triedworksheet.Cell("A1").RichText.Substring(3, 4).SetBold(true).ToString().Remove(1,2);
and
worksheet.Cell("A1").Value=worksheet.Cell("A1").RichText.Substring(3,4).SetBold(true).ToString().Remove(1, 2);
but doesnt work. can someone help me pls.thanks
↧
↧
Source code checked in, #79843
Allow modification of Rich Text's inner text.
↧
New Post: How to bold specific text inside a cell and delete some html tags after bolding
Pick up the latest source code and use the following:
To make it clearer put a breakpoint after the .SetBold() and inspect the RichText. You'll see that it's now a collection of rich strings and it has 3 items. The second one is in bold.
/Manuel
var wb = new XLWorkbook();
var ws = wb.AddWorksheet("Sheet");
ws.FirstCell().Value = "<b>test</b>" + System.Environment.NewLine + "test1";
ws.FirstCell().RichText.Substring(3, 4).SetBold();
ws.FirstCell().RichText.ForEach(richString => richString.Text = richString.Text.Replace("<b>", "").Replace("</b>", ""));
The problem is that when you change the formatting of a rich text, Excel splits the string into multiple "runs" (each with its own formatting). If you want to modify the text then you have to go through each rich string inside the RichText and modify it independently.To make it clearer put a breakpoint after the .SetBold() and inspect the RichText. You'll see that it's now a collection of rich strings and it has 3 items. The second one is in bold.
/Manuel
↧
New Post: How to bold specific text inside a cell and delete some html tags after bolding
Wow this is great! Your solution is clean and you replied so fast. Yes i also breakpoint and saw that it was chop into bits but im not that good in linq thats why i posted.
Thank you very much MDeleon. Ill try this one out.
Thank you very much MDeleon. Ill try this one out.
↧
↧
New Post: How to bold specific text inside a cell and delete some html tags after bolding
Btw i got an error "Property or indexer CLosexml.excel.ixlrichstring.text cannot be assigned because its readonly.
im using
ClosedXML for .Net Framework 4.0 (ClosedXML 0.69.1)
in the downloads page
Am i missing something?
Thanks
im using
ClosedXML for .Net Framework 4.0 (ClosedXML 0.69.1)
in the downloads page
Am i missing something?
Thanks
↧
New Post: Conditional Formatting: Color Row
Hi all.
Is it possible to color an entire row depending on a cell value?
I searched everywhere and nothing found.
Thanks
Is it possible to color an entire row depending on a cell value?
I searched everywhere and nothing found.
Thanks
↧
New Post: Conditional Formatting: Color Row
See Conditional Formatting in the documentation page
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
I'm creating an excel sheet and trying to open it without saving it but it doesn't seem to work. If I save the file first and then open the file everything works fine though. Any suggestions? Here's my code...
Private Sub ExporttoExcel(table As DataTable)
'your datatable
Dim wb As New XLWorkbook()
table.TableName = "export"
wb.Worksheets.Add(table)
'wb.SaveAs("export.xlsx")
' Prepare the response
Dim httpResponse As HttpResponse = Response
httpResponse.Clear()
httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
httpResponse.AddHeader("content-disposition", "attachment;filename=""export.xlsx""")
' Flush the workbook to the Response.OutputStream
Using memoryStream As New MemoryStream()
wb.SaveAs(memoryStream)
memoryStream.Position = 0
memoryStream.CopyTo(httpResponse.OutputStream)
'memoryStream.WriteTo(httpResponse.OutputStream)
memoryStream.Close()
End Using
httpResponse.End()
End Sub
↧
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
I don't understand, you're trying to "open" an Excel file without the file existing on disk? Excel can only open files on disk.
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
If you're in IE you get that nice little toolbar to pop up at the bottom of the window that gives you the option to either "Open" the file or "Save" it. When I click "Open" I get that error message, if I first "Save" the file it opens just fine.
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
1) Why not use WriteTo OutputStream?
2) What happens when you get the download dialog box and you click on "Open"? Does Excel opens and tries to open the file but can't?
2) What happens when you get the download dialog box and you click on "Open"? Does Excel opens and tries to open the file but can't?
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
1) Same error message is generated.
2) Excel opens but the file does not and when I check my "Downloads" folder the file is not there.
2) Excel opens but the file does not and when I check my "Downloads" folder the file is not there.
↧
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
What happens when you click http://spreadsheetpage.com/downloads/xl/worksheet%20functions.xlsx?
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
First I'm prompted with a dialog in the center of the browser with the options to "Open", "Save", and "Save As". When I select open the toolbar opens at the bottom of the window showing progress, then excel opens and the spread opens in "Protected View". This is what I'm looking to accomplish. I wonder if it has anything to do with me running the code on localhost?
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
I officially have no idea. The file is created correctly (since you can open it after saving it explicitly). But after you click "Open" instead, something's happening between IE saving the file in the temp folder and Excel opening it up. Have you tried it with Firefox or Chrome?
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
Negative, because it has to work in IE minimally. One question about your link though, you have the file in the link specified as an excel file. I'm creating mine when clicking a LinkButton on an ASPX page, could this have anything to do with it?
↧
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
Shoot, you're right. It's being served differently.
I don't know how to help you but I'm pretty sure it has something to do with your setup. That's because a lot of people serve Excel files in the same way without a problem.
Sorry I can't be of more help.
I don't know how to help you but I'm pretty sure it has something to do with your setup. That's because a lot of people serve Excel files in the same way without a problem.
Sorry I can't be of more help.
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
No worries, I'll figure it out eventually. :)
↧
New Post: Excel cannot open file because the file format or file extension is not valid.
FYI, once I deployed my app to my production web server everything worked and fell into place so obviously something is up with my local setup. Thx for all your help earlier.
↧