rogersb

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 44 total)
  • Author
    Posts
  • in reply to: How to add a jquery chart to an openxml word doc? #3351

    rogersb
    Participant

    Ive done the approach you suggest. one word doc with those labels on the right showing, another with them deleted. virtually identical. 3 differences, they were the rsid

    Paragraph paragraph1 = new Paragraph(){ RsidParagraphMarkRevision = “00FA5535”, RsidParagraphAddition = “00D8122F”, RsidParagraphProperties = “006C43BF”, RsidRunAdditionDefault = “00E0550F” };
    the very last bit was different by “00C73983” }

    all 3 differences are identical to this.

    I am guessing that the chart is simply “reset”. as a kludge, I made the text font of the %values the same grey color as the background. but many charts are coming up with 100% and the half of a ‘0’ is showing up.

    So there are 2 problems, the scaling of the graphs and the other half of the %value marker is not staying deleted. If I could make a template that may work, but after days of trying that, still not working.

    have the ecma pdf. older one as you suggested. will try to find and figure out. 60+ people waiting for it this morning, now, need to print now. my fault for not having it done…

    in reply to: How to add a jquery chart to an openxml word doc? #3317

    rogersb
    Participant

    Ok, so far havent found it.

    Trying to put the labels of the 3 bars on the LEFT side. They are on the right. have tried to modify the template, cannot figure out how even to do this. do you know how to put the labels on the left side of the bar chart?

    in reply to: How to add a jquery chart to an openxml word doc? #3299

    rogersb
    Participant

    Eric,
    any idea how i can find the setting to force “charts axis options bounds minimum” to be 0? it is scaling the values, they MUST be locked at 0 – 100.

    In the constructed chart that results from the code, it scales to .86 (in this case) to land the chart values near the center. I can go into the chart in the resulting docx right click and manually change it to 0, then its correct. That is unacceptable…

    I search for 86 in the code and find this:
    ` C.CategoryAxis categoryAxis1 = new C.CategoryAxis();
    C.AxisId axisId3 = new C.AxisId(){ Val = (UInt32Value)775286528U };`

    it has ’86’ in there. I have tried setting the style and saving the setting at zero for the bounds, it auto scales anyway

    what would it be called? what parameter name?

    in reply to: How to add a jquery chart to an openxml word doc? #3275

    rogersb
    Participant

    i have tried to “lock” the settings in the docx template, but they are trampled on by the program and arbitrarily get set.

    Its possible that since they get deleted they go to default, so whats needed is to find how to set those obscure parameters. Also the chart series names don’t need to be over written but attempts to comment out this part hasnt worked right

    in reply to: How to add a jquery chart to an openxml word doc? #3274

    rogersb
    Participant

    charts axis options bounds minimum. it gets set to .86 by the software

    range is 0 to 1

    bounds maximum is 1.0 meaning 100%

    something is setting that bounds minumum from 0 and making it .86 which ruins the chart data, do you have any idea what part of the code may be doing this or how to force the value to 0 ?

    in reply to: How to add a jquery chart to an openxml word doc? #3273

    rogersb
    Participant

    Eric

    If you could please describe how this could happen: the bar chart is made, the template in word is used and its formed to a new docx and the user downloads it so the original is not overwritten, but on the bar chart there is a 0 – 100% label at the bottom ok?

    in your code there is a 2d array, ChartData. SeriesNames I dont use, they are “. ” just so they dont print, i have 3 category names, values i use vars for the new double[][]

    its a 0-100 bar chart. for most projects run it shows up fine, but on one? instead of starting at 0 the chart starts at 86 – 100 as if its resizing or re scaling automatically, or if something is ruining the series data. the 3 series are: 91, 95, 95. so instead of start at 0 ? it starts at 86 so that the 91 is at the 40% mark instead of the 91% mark

    what could be causing the code to choose to not start at 0? how is the 0-100 scale plotted?

    the rest of it is maybe 90% working, I have not found how to control the fonts or font color, it chooses to overwrite those settings, thats not good, but the scale starting at 86% ???

    what could do that?
    thanks

    in reply to: How to add a jquery chart to an openxml word doc? #3254

    rogersb
    Participant

    The problem now is that the formatting is being stepped on. If I set the template .docx chart to have BLACK font? it gets re-written with BLUE font. If the font is set to WHITE? its re written to BLUE.

    if I make changes in the document and styling? they are ignored. but what does it matter

    in reply to: How to add a jquery chart to an openxml word doc? #3240

    rogersb
    Participant

    chart failure

    Any help is GREATLY appreciated!

    how can I get the code to leave the formatting alone? When using the chartupdater.cs by itself it did seem to use what was there, it just obliterated the content control making it a one time use. now that i save the modified byte[] to a document then download to the user? it steps on the formatting

    the ALL Green one is wrong. The values are different but the problem is the formatting, it should have a green area for used, and the series names were removed because they cannot be edited after the code writes them.

    what is needed to preserve the coloring and shading? or how to manually enter it????

    this is very much overdue now,
    thanks

    • This reply was modified 8 years, 9 months ago by  rogersb.
    • This reply was modified 8 years, 9 months ago by  rogersb.
    • This reply was modified 8 years, 9 months ago by  rogersb.
    in reply to: How to add a jquery chart to an openxml word doc? #3239

    rogersb
    Participant

    update:
    I added the code to my web based app. It references a word.docx as a template but then saves the file back to the user with a saveAs, or save to /Downloads/ folder

    problem:
    now it smears the color of the barchart. Template: its a horizontal 0-100%, the used part is green, the unused is light gray, the used part has the value, unused is blank.

    Actual result: both unused and used are the same green color, both sides have the % value written in

    Why is the formatting smearing like this? it was enough struggle to make it get this far in the chart updater.cs it did not step on the formatting

    Any ideas on how to preserve the formatting of the color and similar settings?

    in reply to: How to add a jquery chart to an openxml word doc? #3234

    rogersb
    Participant
       public static bool UpdateChart(WordprocessingDocument wDoc, string contentControlTag, ChartData chartData)
        {
            var mainDocumentPart = wDoc.MainDocumentPart;
            var mdXDoc = mainDocumentPart.GetXDocument();
            var cc = mdXDoc.Descendants (W.sdt)
              .LastOrDefault(sdt => (string)sdt.Elements(W.sdtPr).Elements(W.tag).Attributes(W.val).FirstOrDefault() == contentControlTag);
            if (cc != null)
            {
                var chartRid = "rId5";// (string)cc.Descendants(C.chart).Attributes(R.id).FirstOrDefault();
                if (chartRid != null)
                {
                    ChartPart chartPart = (ChartPart)mainDocumentPart.GetPartById(chartRid);
                    UpdateChart(chartPart, chartData);
                    var newContent = cc.Elements(W.sdtContent).Elements().Select(e => new XElement(e));
                   // cc.AddAfterSelf(newContent)
                    cc.ReplaceWith(newContent);
                    mainDocumentPart.PutXDocument();
                    return true;
                }
            }
            return false;
        }

    here where it says cc.ReplaceWith() the content control is removed from the word doc. Is there some way to set this up so the doc can be used more than once?

    ok, perhaps if i could save the file with a different name than what it had and not write over the original…

    in reply to: How to add a jquery chart to an openxml word doc? #3230

    rogersb
    Participant

    chart Updater.cs

    this is the project Im now using

    in reply to: How to add a jquery chart to an openxml word doc? #3229

    rogersb
    Participant

    Hi Eric
    The problem now is dealing with the content control being deleted by code in your (most excellent) code example called Chartupdater. I downloaded that project that modifies multiple word doc’s using a dos console app

    I modified the code to find my one word doc, I added the chart, colored it, labelled the series and all that, figured out how to set the data, all done right? no. I surround the chart with the content control and set the option DO NOT DELETE the content control, I think these CC’s have flaws but the code deletes the content control, so it is a one-use application.

    In order to ‘see’ the chart, even though I know the rid is rId5, i put it in a content control and name it Chart1, zip bang it works and modifies the docx and saves it. But it can only be done one time

    How can I modify the code so that the chart values can be changed as many times as needed? I think if I could find the chart without having to id the content control, then ‘replace’ it;

    But i switched mid stream here, I was using the code from your youtube video that i transcribed, but then this project from your site almost works. zaps the content control and after that the data values do not get updated. Can you tell me a scheme to put a tag or ? to find where the chart is? or how to use the cc without erasing it?

    in reply to: How to add a jquery chart to an openxml word doc? #3226

    rogersb
    Participant

    Can you please help me figure out how to direct UpdateChart to point to the chart some other way? Such as directly after some string literal on the document so that the template can be re-used?

    the chart rid is rId5. i have tried numerous ways to add a string literal @chartHere and have it use the next slot, which worked for the tables, not this.

    content controls get obliterated each use

    in reply to: How to add a jquery chart to an openxml word doc? #3225

    rogersb
    Participant

    Wrapping the chart with a rich text context control, even saying “Content Control CAN NOT BE DELETED” it deletes it anyway.

    So far you get 1 use of the template then have to go back and add the content control each time its used

    in reply to: How to add a jquery chart to an openxml word doc? #3224

    rogersb
    Participant

    Something is blocking any changes from happening in the chart. its been modified by the ChartUpdate.cs and it replaced the series names and all. But clicking on Edit? has no effect on anything, and it seems to have removed the content control; its no longer there. I named it Chart1 and the software found and updated it.

    Now the chart cant be changed. The software changed the series names, and they cannot be changed back. It put 4 bars with 3 series. No, there has to be 3 bars and 2 series. Was trying to comment out where the code changes those names…

Viewing 15 posts - 16 through 30 (of 44 total)